CTResource

Description

The CTResource class deals with c-tree resource concepts.

See also

CTBase

Preconditions

Resources must be defined, which is the default for FairCom DB for .NET tables.

CTResource Methods

CTResource.Add

Add a new resource to a table.

Declaration

void CTResource.Add(pVOID data, VRLEN size);

Description

The resource data is any collection of data that you wish to store as a Resource. It can be a character string, a structure, or any variable type. size indicate the number of bytes occupied by data.

Adds a new resource to a table. When adding a Resource to a table, a special variable-length record is written to the table, containing the information from the Resource Data Block. This is done even if a data file uses fixed-length records. Every Resource is identified by a unique combination of a Resource Type and a Resource Number. The Resource Number can optionally be assigned by c-tree Plus during the call to CTResource.Add(). In addition, each Resource can be identified by a Resource Name. The Resource Name is not guaranteed to be unique.

The Resource Type must be a value greater than 65536. 0 through 65536 are reserved for FairCom use. If the Resource Number is a value of CTDB_ASSIGN_RESOURCE_NUMBER (0xffffffff), c-tree Plus assigns this Resource the next available Resource Number for this Resource Type in the specified data file. The assigned number can be retrieved by calling ctdbGetResourceNumber before the resource handle is released. The Resource Name is optional. Names starting with "FC!" or "RD!", are reserved for FairCom use.

Return

None

See Also

CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.Delete

Delete a resource.

Declaration

void CTResource.Delete();

Description

Deletes a resource from a table. Before a resource can be deleted, the table must be opened exclusive. The resource type and resource number that identify this resource must be passed to one of the CTResource constructors.

Return

None

See Also

CTResource.Add(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.Find

Find a resource by type and number of by name.

Declaration

CTBOOL CTResource.Find(ULONG type, ULONG number, CTBOOL lock) const;

CTBOOL CTResource.Find(const CTString& name, CTBOOL lock) const;

Description

The first overloaded method locates and retrieves a resource in a table based on type and number. Parameters type and number are values that should uniquely identify the resource and lock is used to indicate if the resource should be locked, if it is found.

The second overloaded method locates and retrieves a resource by name. c-tree Plus cannot guarantee unique resource names. Parameter name is the resource name and lock is used to indicate if the resource should be locked, if it is found.

Return

Returns YES if the resource was located and retrieved or NO if the resource could not be found. In case of error, a CTException is thrown.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.First

Retrieve the first resource stored in a table.

Declaration

CTBOOL CTResource.First(CTBOOL lock) const;

Description

Retrieves the first resource stored in a table. lock is used to indicate if the resource should be locked, if it is found.

Return

Returns YES if the first resource was retrieved or NO if first resource does not exist. In case of error, a CTException is thrown.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.GetData

Retrieve the resource data.

Declaration

pVOID CTResource.GetData() const;

Description

Retrieves the resource data

Return

Returns a pointer to the resource data.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.GetDataLength

Retrieve the resource data length.

Declaration

VRLEN CTResource.GetDataLength() const;

Description

Retrieves the resource data length in bytes.

Return

Returns the resource data length.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.GetName

Retrieve the resource name.

Declaration

CTString CTResource.GetName() const;

Description

Retrieves the resource name.

Return

Returns the resource name.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.GetNumber

Retrieve the resource number.

Declaration

ULONG CTResource.GetNumber() const;

Description

Retrieves the resource number.

Return

Returns the resource number.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.GetType

Retrieve the resource type.

Declaration

LONG CTResource:.GetType() const;

Description

Retrieves the resource type.

Return

Returns the resource type.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.IsLocked

Check if resource is locked.

Declaration

CTBOOL CTResource::IsLocked() const;

Description

Check if a resource is locked.

Return

Returns YES is a resource is locked or NO is a resource is not locked.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), Locking

CTResource.Next

Retrieve the next resource stored in a table.

Declaration

CTBOOL CTResource::Next(CTBOOL lock) const;

Description

Retrieves the next resource stored in a table. lock is used to indicate if the resource should be locked, if it is found.

Return

Returns YES if the first resource was retrieved or NO if first resource does not exist. In case of error, a CTException is thrown.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.SetData

Set the resource data.

Declaration

void CTResource::SetData(pVOID data, VRLEN size);

Description

Sets the resource data.

Return

None

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.SetName

Declaration

void CTResource::SetName(const CTString& name);

Description

Sets the resource name.

Return

None.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.SetNumber

Set the resource number.

Declaration

void CTResource::SetNumber(ULONG number);

Description

Sets the resource number.

Return

None.

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.SetType

Set the resource type.

Declaration

void CTResource::SetType(ULONG type);

Description

Sets the resource type.

Return

None

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()

CTResource.Unlock

Unlock a resource..

Declaration

void CTResource::Unlock();

Description

Unlocks a resource. The resource is only unlocked if it was previously locked by First(), Next() or Find().

Return

None

See Also

CTResource.Add(), CTResource.Delete(), CTResource.Update(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.IsLocked(), Locking

CTResource.Update

Update an existing resource.

Declaration

void CTResource::Update(pVOID data, VRLEN size);

Description

Updates an existing resource. You must instantiate the resource object with the specific resource type and number that will uniquely identify the resource being updated. The resource data is any collection of data that you wish to store as a Resource. It can be a character string, a structure, or any variable type. size indicates the number of bytes occupied by data.

Return

None

See Also

CTResource.Add(), CTResource.Delete(), CTResource.First(), CTResource.Next(), CTResource.Find(), CTResource.GetType(), CTResource.SetType(), CTResource.GetNumber(), CTResource.SetNumber(), CTResource.GetName(), CTResource.SetName(), CTResource.GetDataLength(), CTResource.GetData(), CTResource.SetData(), CTResource.Unlock(), CTResource.IsLocked()