# hp Reliable Transaction Router
C++ Foundation Classes

Previous | Contents | Index

# Remove

## RTRFacilityMemberArray::Remove();

## Prototype

>     bool Remove (const size_t n);

## Return Value

> True or False

## Parameters

> ### n

> The element in the array (ar[0] is the first element). The element is a pointer to an object.

## Description

> This method removes the nth element of the array. This does not destroy the object pointed to; the caller must delete the contents.

## Example

>         bool bArrayRemoveStatus;
>         bArrayRemoveStatus = ar.Remove(1);
>         if (IsFailure(bArrayRemoveStatus))
>         {
>         cout << "      RTRFacilityMemberArray::Remove failed\n";
>         }
>         return bArrayRemoveStatus;

# RTRFacilityMemberArray

## RTRFacilityMemberArray:: RTRFacilityMemberArray();

## Prototype

>     RTRFacilityMemberArray();
>     virtual ~RTRFacilityMemberArray;

## Return Value

> None

## Parameters

> None

## Description

> Construct an RTRFacilityMemberArray object.

## Example

>     RTRFacilityMemberArray::RTRFacilityMemberArray()
>     {
>     }

# Size

## RTRFacilityMemberArray::Size();

## Prototype

>     size_t Size() const;

## Return Value

> size_t

## Parameters

> None

## Description

> The method returns the number of elements in the array.

## Example

>     size_t nArraySize = ar.Size();
>     if (IsFailure(nArraySize == 1))
>     {
>     cout << "      RTRFacilityMemberArray::Size failed\n";
>     }
>     return nArraySize == 1;

# 4.6 RTRFacilityProperties

RTRFacilityProperties provides members that can retrieve a list of nodes and their roles in a facility and enable reconnection of frontends and routers based on the number of connections on each active router.

# RTRFacilityProperties Class Members

Construction

Method | Description
--- | ---
RTRFacilityProperties(rtr_const_facnam_t) | Constructor
~RTRFacilityProperties | Destructor

Operations

Method | Description
--- | ---
GetMemberList(RTRFacilityMemberArray) | Retrieves a list of nodes and their roles for an existing facility.
SetBalance(bool) | Allows intelligent reconnection of frontend to routers according to the number of connections on each active router.

# 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:

- rtr_keyseg_signed
- rtr_keyseg_unsigned
- rtr_keyseg_string

## 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:
> - rtr_keyseg_signed
> - rtr_keyseg_unsigned
> - rtr_keyseg_string

> ### 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:
> - rtr_keyseg_signed
> - rtr_keyseg_unsigned
> - rtr_keyseg_string

## 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;

Previous | Next | Contents | Index