Reliable Transaction Router
C++ Foundation Classes


Previous Contents Index


GetMemberList()


RTRFacilityProperties::GetMemberList();


Prototype


rtr_status_t GetMemberList(RTRFacilityMemberArray &aFacilityMembers); 


Return Value

rtr_status_t Interpret value for the success or failure of this call.
Status Message
RTR_STS_OK Normal successful completion.
RTR_STS_DATANOTAVAILABL Member list data not available.


Parameters

aFacilityMembers

An array listing a facility's members.

Description

Retrieve a list of nodes and their roles for an existing facility.

Example


rtr_status_t stsGetMemberList; 
RTRFacilityMemberArray arFacMembers; 
stsGetMemberList = FacProps.GetMemberList(arFacMembers); 
if (IsFailure(stsGetMemberList == RTR_STS_OK)) 
{ 
bOverallResult = false; 
OutputStatus(stsGetMemberList); 
} 
int nNbrFacMembers = arFacMembers.Size(); 
for (int i=0; i<nNbrFacMembers; i++) 
{ 
delete arFacMembers[i]; 
} 
CleanupRTR(); 
return bOverallResult; 


RTRFacilityProperties()


RTRFacilityProperties::RTRFacilityProperties();


Prototype


RTRFacilityProperties( rtr_const_facnam_t pszFacilityName); 
virtual ~RTRFacilityProperties(); 


Return Value

None

Parameters

pszFacility

A null-terminated pointer to a facility name.

Description

This method retrieves the properties associated with the facility object.

Example


char *pszFacility = "Myfacilityname"; 
RTRFacilityProperties *FacilityPropterties = new 
                               RTRFacilityProperties(pszFacility); 
 


SetBalance()


RTRFacilityProperties::SetBalance();


Prototype


rtr_status_t SetBalance( bool bBalancingOn ); 


Return Value

rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.

Parameters

bBalancingOn

A boolean attribute for specifying RTR balancing of client requests for server processing.

Description

Specifies whether router balancing is to be performed.

Example


rtr_status_t  sStatus; 
char *pszFacilityName= "MyfacilityName"; 
bool bBalanceON = true; 
sStatus = MyFacilityProperties->SetBalance(bBalanceOn); 

4.7 RTRKeySegment

A key segment describes the data that the RTR application is sending. RTR uses this description for routing the data to an appropriate server. Key segments are of no value unless they are associated with a partition. When creating a partition, the caller is allowed to specify one or more key segments.

The RTRKeySegment class defines key segments (ranges) used in defining RTRPartition objects. RTRPartition objects are used to enable the partitioning of data across multiple servers.


RTRKeySegment Class Members

Construction
Method Description
RTRKeySegment(rtr_keyseg_type_t, rtr_keylen_t, rtr_keylen_t, rtr_const_pointer_t, rtr_const_pointer_t) Constructor
~ RTRKeySegment() Destructor

Operations
Method Description
GetKeySegmentHighValue() Gets the upper bound of the key range for the key segment.
GetKeySegmentLength() Gets the length of the key segment key.
GetKeySegmentLowValue() Gets the lower bound of the key range for the key segment.
GetKeySegmentOffset() Gets the offset of the key segment key.
GetKeySegmentType() Gets the type of the key segment.
SetKeySegmentHighValue(rtr_const_pointer_t) Sets the upper bound of the key range for the key segment.
SetKeySegmentLength(const rtr_keylen_t) Sets the length of the key segment key.
SetKeySegmentLowValue(rtr_const_pointer_t) Sets the lower bound of the key range for the key segment.
SetKeySegmentOffset(const rtr_keylen_t) Sets the offset of the key segment key.
SetKeySegmentType(const rtr_keyseg_type_t) Sets the type of the key segment.


GetKeySegmentHighValue()


RTRKeySegment::GetKeySegmentHighValue();


Prototype


rtr_pointer_t GetKeySegmentHighValue(); 


Return Value

rtr_pointer_t Pointer to the returned upper-bound key value.

Parameters

None

Description

This method returns the upper-bound key value of the key segment.

Example


RTRKeySegment CharacterStringSegment.GetKeySegmentHighValue(); 


GetKeySegmentLength()


RTRKeySegment::GetKeySegmentLength();


Prototype


rtr_keylen_t GetKeySegmentLength(); 


Return Value

rtr_keylen_t The returned value is the length of the key segment.

Parameters

None

Description

This method gets the length of the key segment key.

Example


rtr_keylen_t keylength = 
                    CharacterStringSegment.GetKeySegmentLength(); 


GetKeySegmentLowValue()


RTRKeySegment::GetKeySegmentLowValue();


Prototype


rtr_pointer_t GetKeySegmentLowValue(); 


Return Value

rtr_pointer_t Pointer to the returned lower-bound key value.

Parameters

None

Description

This method returns the lower-bound key value of the key segment.

Example


rtr_keylen_t keylength = 
                   CharacterStringSegment.GetKeySegmentLowValue(); 
 


GetKeySegmentOffset()


RTRKeySegment::GetKeySegmentOffset();


Prototype


rtr_keylen_t GetKeySegmentOffset(); 


Return Value

rtr_keylen_t The returned value is the offset of the key value.

Parameters

None

Description

This method gets the offset of the key segment key within the message stream.

Example


rtr_keylen_t keylength = 
                    CharacterStringSegment.GetKeySegmentOffset(); 
 


GetKeySegmentType()


RTRKeySegment::GetKeySegmentType();


Prototype


rtr_keyseg_type_t GetKeySegmentType(); 


Return Value

rtr_keyseg_type_t

One of the values of type rtr_keyseg_type_t, that can be:


Parameters

None

Description

This method gets the data type of the key segment.

Example


rtr_keylen_t keylength = CharacterStringSegment.GetKeySegmentType(); 
 


RTRKeySegment()


RTRKeySegment::RTRKeySegment();


Prototype


RTRKeySegment(rtr_keyseg_type_t keySegmentType, 
              rtr_keylen_t keySegmentLength, 
              rtr_keylen_t keySegmentOffset, 
              rtr_const_pointer_t pKeySegmentLowValue, 
              rtr_const_pointer_t pKeySegmentHighValue ); 
virtual ~RTRKeySegment(); 


Return Value

None

Parameters

keySegmentType

One of the values of type rtr_keyseg_type_t, that can be one of the following:

keySegmentLength

A numerical length value in bytes of type rtr_keylen_t.

Default = 4

keySegmentOffset

A numerical offset value in bytes of type rtr_keylen_t.

Default = 0.

pKeySegmentLowValue

A pointer of type rtr_pointer_t to a lower-bound key value of type rtr_keyseg_type_t.

Default = NULL.

PKeySegmentHighValue

A pointer of type rtr_pointer_t to an upper-bound key value of type rtr_keyseg_type_t.

Default = NULL.


Description

Call this constructor to create an RTRKeySegment object.

Example


    void ClassDerivedFromHandler::StartProcessingOrdersAtoL( ) 
    { 
    // This function defines a key segment and calls 
    StartProcessingOrders to process all orders that have a ticker 
    symbol beginning with the letters A-L. 
    // Create a KeyRange 
    m_pkeyRange = new RTRKeySegment( rtr_keyseg_string, 
                                     1, 
                                     OffsetIntoApplicationProtocol, 
                                    "A", 
                                    "L" ); 
    StartProcessingOrders(PARTITION_NAMEAToL,m_pkeyRange); 
    } 


SetKeySegmentHighValue()


RTRKeySegment::SetKeySegmentHighValue();


Prototype


rtr_status_t SetKeySegmentHighValue(rtr_const_pointer_t pKeySegmentHighValue ); 


Return Value

rtr_status_t Interpret value for the success or failure of this call.
Status Message
RTR_STS_OK Normal successful completion.
RTR_STS_INVKYSGVLPTARG Invalid key segment value pointer argument.

Parameters

pKeySegmentHighValue

Pointer to the upper-bound key value to be set.

Description

This method sets the upper bound of the key range for the key segment.

Example


rtr_keyseg_type_t PKeySegmentHighValue = L; 
CharacterStringSegment.SetKeySegmentHighValue(KeySegmentHighValue); 


SetKeySegmentLength()


RTRKeySegment::SetKeySegmentLength();


Prototype


rtr_status_t SetKeySegmentLength(const rtr_keylen_t keySegmentLength ); 


Return Value

rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.

Parameters

keySegmentLength

This parameter holds the key length value of type rtr_keylen_t to be set.

Description

This method sets the length of the key segment key.

Example


rtr_keylen_t keylength = 1; 
CharacterStringSegment.SetLength(keylength); 
 


SetKeySegmentLowValue()


RTRKeySegment::SetKeySegmentLowValue();


Prototype


rtr_status_t SetKeySegmentLowValue(rtr_const_pointer_t pKeySegmentLowValue); 


Return Value

rtr_status_t Interpret value for the success or failure of this call.
Status Message
RTR_STS_OK Normal successful completion.
RTR_STS_INVKYSGVLPTARG Invalid key segment value pointer argument.

Parameters

pKeySegmentLowValue

Pointer to the lower-bound key value to be set.

Description

This method sets lower bound of the key range for the key segment.

Example


rtr_keyseg_type_t PKeySegmentLowValue = A; 
CharacterStringSegment.SetKeySegmentLowValue(KeySegmentLowValue); 


SetKeySegmentOffset()


RTRKeySegment::SetKeySegmentOffset();


Prototype


rtr_status_t SetKeySegmentOffset( const rtr_keylen_t keySegmentOffset ); 


Return Value

rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.

Parameters

keySegmentOffset

This parameter holds the key segment key offset of type rtr_keylen_t.

Description

This method sets the offset of the key segment key within the message stream.

Example


rtr_keylen_type_t PKeySegmentOffset = ; 
CharacterStringSegment.SetKeySegmentOffset(KeySegmentOffset); 
 


SetKeySegmentType()


RTRKeySegment::SetKeySegmentType();


Prototype


rtr_status_t SetKeySegmentType( const rtr_keyseg_type_t keySegmentType); 


Return Value

rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.

Parameters

keySegmentType

One of the values of type rtr_keyseg_type_t, that can be one of the following:

Description

This method sets the data type of the key segment.

Example


rtr_status_t stsSetKeySegmentType; 
rtr_keyseg_type_t NewType = rtr_keyseg_string; 
stsSetKeySegmentType = KeySeg.SetKeySegmentType(NewType); 
if (IsFailure(stsSetKeySegmentType == RTR_STS_OK)) 
{ 
bOverallResult = false; 
} 
rtr_keyseg_type_t CurrType; 
CurrType = KeySeg.GetKeySegmentType(); 
if (IsFailure(CurrType == NewType)) 
{ 
bOverallResult = false; 
cout << )      RTRKeySegment::Set/GetKeySegmentType failed.\n); 
} 
return bOverallResult; 

4.8 RTRKeySegmentArray

An RTRKeySegmentArray object contains pointers to array elements.

Note

The RTRKeySegmentArray class requires the holder of the array to clean up (delete) the objects pointed to by the elements of the array; the array does not clean up these objects (does not delete the contents of the array).

RTRKeySegment Class Members

Construction
Method Description
RTRKeySegmentArray() Constructor
~ RTRKeySegment() Destructor

Operations()
Method Description
Add(RTRKeySegment) Add a pointer to the array.
Clear() Clear the elements of the array.
Insert(size_t, RTRKeySegment) Insert a pointer to an RTRKeySegment member.
Remove() Remove an element of the array.
RTRKeySegment operator( size_t) Return an element of the array which will be a pointer to an RTRKeySegment member.
Size() Return the number of elements in the array.


Add()


RTRKeySegmentArray::Add();


Prototype


bool Add(RTRKeySegment* pFacMember); 


Return Value

True or False

Parameters

pFacMember

Pointer to a facility member.

Description

Add a pointer to an RTRKeySegment member to the array. The caller is responsible for creating and destroying the actual object. The array destructor does not destruct the objects pointed to.

Example


bool RTRKeySegmentArray::Add () 
{ 
bool bArrayAddStatus; 
RTRKeySegmentArray ar; 
RTRKeySegment* pKeySeg; 
unsigned low=0; 
unsigned high=10000; 
pKeySeg = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 
                             0, &low, &high); 
if (IsFailure(pKeySeg != NULL)) 
return false; 
bool bAddOk = ar.Add(pKeySeg); 
if (IsFailure(bAddOk == true)) 
{ 
delete pKeySeg; 
return false; 
} 
delete pKeySeg; 
return true; 
} 


Clear()


RTRKeySegmentArray::Clear();


Prototype


bool Clear(); 


Return Value

True or False

Parameters

None

Description

This method clears the elements of the array, resulting in the array having a size of zero. The Clear method does not destroy the objects pointed to.

Example


bool RTRKeySegmentArray::Clear () 
{ 
bool bArrayAddStatus; 
RTRKeySegmentArray ar; 
RTRKeySegment* pKeySeg0 = NULL; 
RTRKeySegment* pKeySeg1 = NULL; 
unsigned low0=0; 
unsigned high0=10000; 
unsigned low1=10001; 
unsigned high1=20000; 
pKeySeg0 = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 
                             0, &low0, &high0); 
if (IsFailure(pKeySeg0 != NULL)) 
return false; 
bool bAddOk = ar.Add(pKeySeg0); 
if (IsFailure(bAddOk == true)) 
{ 
delete pKeySeg0; 
return false; 
} 
if (ar.Size() != 1) 
{ 
delete pKeySeg0; 
return false; 
} 
pKeySeg1 = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 
                             0, &low1, &high1); 
if (IsFailure(pKeySeg1 != NULL)) 
{ 
delete pKeySeg0; 
return false; 
} 
bool bInsertOk = ar.Insert(0, pKeySeg1); 
if (IsFailure(bInsertOk == true)) 
{ 
delete pKeySeg0; 
delete pKeySeg1; 
return false; 
} 
bool bClearOk = ar.Clear(); 
if (IsFailure(bClearOk == true)) 
{ 
delete pKeySeg0; 
delete pKeySeg1; 
return false; 
} 
if (IsFailure(ar.Size() == 0)) 
{ 
delete pKeySeg0; 
delete pKeySeg1; 
return false; 
} 
delete pKeySeg0; 
delete pKeySeg1; 
return true; 
} 


Previous Next Contents Index