Previous | Contents | Index |
bool Insert(size_t n, RTRKeySegment* pFacMember);
True or False
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.pFacMember
Pointer to a facility member.
Insert a pointer to an RTRKeySegment member into the Nth position, moving the remainder of the array to make room.
bool RTRKeySegmentArray::Insert () { bool bArrayAddStatus; RTRKeySegmentArray ar; RTRKeySegment* pKeySeg0; RTRKeySegment* pKeySeg1; unsigned low0=0; unsigned low1=10001; unsigned high0=10000; 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; } delete pKeySeg0; delete pKeySeg1; return true; }
size_t Remove(const size_t n);
size_t The amount of allocated space.
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
This method removes the Nth element of the array. Calling this method does not destroy the object pointed to; the caller needs to delete the contents.
bool RTRKeySegmentArray::Remove () { 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; } bool bRemoveOk = ar.Remove(0); if (IsFailure(bRemoveOk == true)) { delete pKeySeg; return false; } delete pKeySeg; return true; }
RTRKeySegmentArray(); virtual ~RTRKeySegmentArray();
None
None
Call this method to construct new RTRKeySegmentArray object.
Test_RTRKeySegmentArray::Test_RTRKeySegmentArray () { }
RTRKeySegment*& operator[ ] (size_t n);
Returns the Nth element of the array.
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
This operator returns the Nth element of the array which will be a pointer to an RTRKeySegment member. This operator can also be used to set the Nth element of the array. The existing element pointed to is not destroyed; the caller must delete this.
bool Test_RTRKeySegmentArray::arrayoper() { 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; } if (ar.Size() != 1) { delete pKeySeg; return false; } RTRKeySegment* pSeg0 = ar[0]; if (IsFailure(pSeg0 != NULL)) { delete pKeySeg; return false; } delete pKeySeg; return true; }
size_t Size() const;
size_t The amount of space to be allocated.
None
The method returns the number of elements in the array.
bool RTRKeySegmentArray::Size () { 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; } if (ar.Size() != 1) { delete pKeySeg; return false; } delete pKeySeg; return true; }
4.9 RTRPartitionManager
The RTRPartitionManager allows the RTR applictaion to create, delete
and obtain properties for a partition.
A partition is composed of one or more key segments. These key segments define the location of data within the applications message, the type of the data and a range of values for the data. RTR uses this information to perform its data routing. One or more partitions can be registered with a server transaction controller.
The key segments are associated with a partition when the partition is created. A partition exists within one facility. A facility can have many partitions.
Construction
Method | Description |
---|---|
RTRPartitionManager() | Constructor |
~RTRPartitionManager() | Destructor |
Operations
Method | Description |
---|---|
CreateBackendPartition(rtr_const_parnam_t, rtr_const_facnam_t, RTRKeySegment, const bool, const bool, const bool) | Creates a partition on a backend within an existing facility. |
CreateBackendPartition(rtr_const_parnam_t, rtr_const_facnam_t, RTRKeySegmentArray, const bool, const bool, const bool) | Creates a partition on a backend within an existing facility.using an RTRKeySegmentArray. |
DeletePartition(rtr_const_parnam_t, rtr_const_facnam_t) | Deletes a partition. |
GetBackendPartitionProperties(rtr_const_parnam_t) | Retrieves properties for a partition on a backend. |
virtual rtr_status_t CreateBackendPartition( rtr_const_parnam_t pszPartitionName, rtr_const_facnam_t pszFacilityName, RTRKeySegment &KeySegment, const bool bShadow = false, const bool bConcurrent = true, const bool bStandby = true); virtual rtr_status_t CreateBackendPartition( rtr_const_parnam_t pszPartitionName, rtr_const_facnam_t pszFacilityName, RTRKeySegment &KeySegmentArray, const bool bShadow = false, const bool bConcurrent = true, const bool bStandby = true);
rtr_status_t Interpret value for the success or failure of this call.
pszPartitionName
A null-terminated pointer to a partition name.pszFacilityName
A null-terminated pointer to a facility name.KeySegment
A key segment for the specified partition name.KeySegmentArray
An array of key segments for the specified partition name.bShadow
A boolean attribute for specifying a shadow server.bConcurrent
A boolean attribute for specifying a concurrent server.bStandby
A boolean attribute for specifying a standby server.
CreateBackendPartition method creates an RTR backend partition. The partition characteristics that may be defined include key range or ranges and whether attached server process can be shadows or standbys. The command must be issued before any server application programs using the partition are started.
RTRKeySegment *pCharacterStringSegment = new RTRKeySegment( rtr_keyseg_string, 1,0,"y","z"); RTRPartitionManager PartitionManager; sStatus = PartitionManager.CreateBackendPartition( "MyPartition", "myfac", &pCharacterStringSegment, false,true,true); // boolean parameters are for specifying shadow, concurrent, standbyFrom the Sample application in the Examples directory:
RTRPartitionManager PartitionManager; sStatus = PartitionManager.CreateBackEndPartition( ABCPartition1, ABCFacility, KeyZeroTo99,false,true,false);
virtual rtr_status_t DeletePartition( rtr_const_parnam_t pszPartitionName, rtr_const_facnam_t pszFacility );
rtr_status_t Interpret value for the success or failure of this call.
pszPartitionName
A null-terminated pointer to a partition name.pszFacility
A null-terminated pointer to a facility name.
Call this method to delete a partition from a facility.
Char *pszFac = "MyFacility"; Char *pszPartition = "MyPartitionName"; sStatus = PartitionManager.DeletePartition(pszFac,pszPartition);
virtual RTRBackendPartitionProperties* GetBackendPartitionProperties(rtr_const_parnam_t pszPartitionName);
RTRBackendPartitionProperties* Pointer to the RTRBackendPartitionProperties object associated with this RTRPartitionManager object.
Status | Message |
---|---|
RTR_STS_OK | Normal successful completion. |
RTR_STS_INVPARTNAMEARG | The partition name argument is invalid. |
pszPartitionName
A null-terminated pointer to a partition name.
This method retrieves the properties associated with the RTRPartitionManager object. These properties are contained within an associated RTRBackendPartitionProperties object.
RTRBackendPartitionProperties *pPartProperties = PartitionManager.GetBackendPartitionProperties("MyPartition");
RTRPartitionManager(); virtual ~RTRPartitionManager();
None
None
This method defines an RTRPartitionManager object.
RTRPartitionManager PartitionManager;
4.10 RTRSignedCounter
To use a counter, perform the following steps:
Construction
Method | Description |
---|---|
RTRSignedCounter( rtr_const_countername_t, rtr_const_countergroupname_t) | Constructor |
~RTRSignedCounter() | Destructor |
Operations
Method | Description |
---|---|
Decrement() | Decrement the value managed by the counter class. |
GetValue(rtr_sgn_32_t) | Retrieve the value managed by the counter class. |
Increment() | Increment the value managed by the counter class. |
SetValue(rtr_sgn_32_t) | Set the value managed by the counter class. |
rtr_status_t Decrement();
rtr_status_t Interpret value for the success or failure of this call.
The more specific counter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
None
Call this method to decrement a numeric counter. Decrement method can be called only after setting value (RTRSignedCounter::SetValue(CounterVal)).
rtr_const_countername_t kCounter = "test-counter-signed-decrement"; rtr_const_countergroupname_t kGroup = "test-counter-group"; RTRSignedCounter c(kCounter, kGroup); rtr_sgn_32_t v = 0; const rtr_sgn_32_t kValue = 669; bool bOverallResult = true; rtr_status_t stsSetValue; stsSetValue = c.SetValue(kValue); if (IsFailure(stsSetValue == RTR_STS_OK)) { bOverallResult = false; OutputStatus(stsSetValue); } rtr_status_t stsDecrement; stsDecrement = c.Decrement(); if (IsFailure(stsDecrement == RTR_STS_OK)) { bOverallResult = false; OutputStatus(stsDecrement); }
rtr_status_t GetValue(rtr_sgn_32_t &CounterVal);
rtr_status_t Interpret value for the success or failure of this call.
The more specific counter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
RTR_STSCTRBADREF
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
RTR_STS_INVOBJFAILCNSTR
The object is invalid because the values passed in the constructor were invalid.
CounterVal
A counter value for a specified RTR counter.
Call this method to get a counter value. GetValue can be called only after setting value (SetValue).
rtr_status_t stsGetValue; stsGetValue = c.GetValue(v); if (IsFailure(stsGetValue == RTR_STS_OK)) { bOverallResult = false; OutputStatus(stsGetValue); }
Previous | Next | Contents | Index |