Reliable Transaction Router
C++ Foundation Classes


Previous Contents Index


RemoveRouter()


RTRFacilityManager::RemoveRouter();


Prototype


rtr_status_t RemoveRouter( rtr_const_facnam_t pszFacilityName, 
                                             rtr_const_nodnam_t pszRouter ); 


Return Value

rtr_status_t Interpret value for the success or failure of this call.
Status Message
RTR_STS_INVFACNAMEARG The facility name argument is invalid.
RTR_STS_INVROUTRNAMEARG The router name argument is invalid.
RTR_STS_NOROUTERS No more routers are available in this facility.
RTR_STS_ NOSUCHFAC No such facility available.
RTR_STS_OK Normal successful completion.
RTR_STS_RTRNOTSTA RTR is not started.

Parameters

pszFacilityName

A null-terminated pointer to a facility name.

pszRouter

A null-terminated pointer to a facility member with a router (TR) role.

Description

Call this method to remove router nodes from a facility.

Example


rtr_status_t sStatus; 
char *pszFacilityName = "MyFacilityName"; 
char *pszNodeName  = "TRNodeNamesSeparatedbyComma"; 
sStatus = myFac-> RemoveRouter (pszFacilityName,pszNodeName); 
 


RTRFacilityManager()


RTRFacilityManager::RTRFacilityManager();


Prototype


RTRFacilityManager(); 
virtual ~RTRFacilityManager(); 


Return Value

None

Parameters

None

Description

Use this method to declare a facility manager object. Facility manager object should be declared for accessing any properties of a facility.

Example


RTRFacilityManager *myFac = new RTRFacilityManager(); 

4.4 RTRFacilityMember


RTRFacilityMember Class Members

Construction
Method Description
RTRFacilityMember(rtr_const_facnam_t, rtr_const_nodnam_t, const eRTRMemberRoleType) Constructor
~RTRFacilityMember() Destructor

Operations
Method Description
GetName(rtr_facnam_t, const size_t) Retrieve the name of the facility member.
HasBackendRole(bool) Determine if this facility member has a backend role.
HasFrontendRole(bool) Determine if this facility member has a frontend role.
HasRouterRole(bool) Determine if this facility member has a router role.
IsConnectedToLocalNode(bool) Determine if this facility member has connectivity to the local node.
IsLocalNode(bool) Determine if this facility is the local node.


GetName()


RTRFacilityMember::GetName();


Prototype


rtr_status_t GetName( rtr_facnam_t pszFacilityName, const size_t 
                                                    uiFacilityNameSize); 


Return Value

rtr_status_t

Parameters

pszFacilityName

A pointer to a facility name.

uiFacilityNameSize

An unsigned integer for the facility name size.

Description

Retrieve the name of the facility member.

Example


    #define MAX_FACNAME 256 
    char szFacName[MAX_FACNAME]; 
    rtr_status_t stsGetName = FacMember.GetName(szFacName, MAX_FACNAME); 
    if (IsFailure(stsGetName == RTR_STS_OK)) 
    { 
    cout << "      RTRFacilityMember::GetName failed\n"; 
                    OutputStatus(stsGetName); 
    } 
    else 
    {... 


HasBackendRole()


RTRFacilityMember::HasBackendRole();


Prototype


rtr_status_t HasBackendRole(bool &bHasRole); 


Return Value

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

Parameters

bHasRole

A boolean that is true or false for HasBackendRole.

Description

Call this method to find out a node is configured as backend.

Example


rtr_status_t stsHasRole; 
bool bHasRole; 
stsHasRole = FacMember.HasBackendRole(bHasRole); 
if ( IsFailure( stsHasRole == RTR_STS_OK ) ) 
 { 
    bOverallResult = false; 
    OutputStatus( stsHasRole ); 
 } 
bOverallResult = (bHasRole == true); 
 


HasFrontendRole()


RTRFacilityMember::HasFrontendRole();


Prototype


rtr_status_t HasFrontendRole(bool &bHasRole); 
 


Return Value

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

Parameters

bHasRole

A boolean that is true or false for HasFrontendRole.

Description

Call this method to find out if a node is configured as frontend.

Example


rtr_status_t stsHasRole; 
bool bHasRole; 
stsHasRole = FacMember.HasFrontendRole(bHasRole); 
if ( IsFailure( stsHasRole == RTR_STS_OK ) ) 
 { 
    bOverallResult = false; 
    OutputStatus( stsHasRole ); 
 } 
bOverallResult = (bHasRole == true); 


HasRouterRole()


RTRFacilityMember::HasRouterRole();


Prototype


rtr_status_t HasRouterRole(bool &bHasRole); 
 


Return Value

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

Parameters

bHasRole

A boolean that is true or false for HasRouterRole.

Description

Call this method to find out if a node is configured as router.

Example


rtr_status_t stsHasRole; 
bool bHasRole; 
stsHasRole = FacMember.HasRouterRole(bHasRole); 
if ( IsFailure( stsHasRole == RTR_STS_OK ) ) 
 { 
    bOverallResult = false; 
    OutputStatus( stsHasRole ); 
 } 
bOverallResult = (bHasRole == true); 
 


IsConnectedToLocalNode()


RTRFacilityMember::IsConnectedToLocalNode();


Prototype


rtr_status_t IsConnectedToLocalNode(bool &bIsConnected); 


Return Value

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

Parameters

bIsConnected

A boolean that is true if the node is connected to the local node.

Description

Call this method to find out if this node is connected to the local node.

Example


bool bIsConnected; 
rtr_status_t stsIsConnected; 
stsIsConnected = FacMember.IsConnectedToLocalNode(bIsConnected); 
if (IsFailure(stsIsConnected == RTR_STS_OK)) 
 { 
    OutputStatus(stsIsConnected); 
    bOverallResult = false; 
 } 
if (IsFailure(bIsConnected == true)) 
 { 
 cout << "      RTRFacilityMember::IsConnectedToLocalNode failed\n"; 
 bOverallResult = false; 
 } 


IsLocalNode()


RTRFacilityMember::IsLocalNode();


Prototype


rtr_status_t IsLocalNode(bool &bIsLocal); 


Return Value

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

Parameters

bIsLocal

A boolean that is true if the node is a local node.

Description

Call this method to find out if the node is a local node.

Example


rtr_status_t stsIsLocal; 
bool bIsLocalNode; 
stsIsLocal = FacMember.IsLocalNode(bIsLocalNode); 
if (IsFailure(stsIsLocal == RTR_STS_OK)) 
 { 
    OutputStatus(stsIsLocal); 
    bOverallResult = false; 
 } 
if (IsFailure(bIsLocalNode == true)) 
 { 
    cout << "      RTRFacilityMember::IsLocalNode failed\n"; 
    bOverallResult = false; 
 } 


RTRFacilityMember()


RTRFacilityMember::RTRFacilityMember();


Prototype


RTRFacilityMember( rtr_const_facnam_t pszFacilityName, 
                                  rtr_const_nodnam_t pszMemberName); 
virtual ~RTRFacilityMember(); 


Return Value

None

Parameters

pszFacilityName

A null-terminated pointer to a facility name.

pszMemberName

A null-terminated string pointer to the name of a facility member.

Description

Call this method to declare a facility member object. The member role type can be:

Example


Char *pszFac = "Myfacility"; 
Char *pszNode ="NodeName"; 
RTRFacilityMember *FacilityMember = 
                    new RTRFacilityMember(pszFac,pszNode); 

4.5 RTRFacilityMemberArray

An RTRFacilityMemberArray object contains pointers to array elements.

Note

The RTRFacilityMemberArray class requires the holder of the array to clean up the objects pointed to by the elements of the array. The array does not clean up these objects.

RTRFacilityMemberArray Class Members

Construction
Method Description
RTRFacilityMemberArray() Constructor
~RTRFacilityMemberArray() Destructor

Operations
Method Description
Add(RTRFacilityMember) Adds a pointer to an RTRFacility member to the array.
Clear() Clears elements of the array.
Insert(size_t, RTRFacilityMember) Inserts a pointer to an RTRFacility member.
operator[] (size_t) Returns an element of the array which is a pointer to an RTRFacility member.
Remove(const size_t) Removes an element of the array.
Size(const) Returns the number of elements in the array.


Add()


RTRFacilityMemberArray::Add();


Prototype


bool Add(RTRFacilityMember* pFacMember); 


Return Value

True or False

Parameters

pFacMember

A pointer to a facility member.

Description

Add a member to a facility member array by adding a pointer to an RTRFacility member. The caller is responsible for creating and destroying the actual object. The array destructor does not destroy the objects pointed to.

Example


bool RTRFacilityMemberArray::Add() 
{ 
bool bArrayAddStatus; 
RTRFacilityMemberArray ar; 
RTRFacilityMember* pFacMember; 
 
pFacMember = new RTRFacilityMember(GetDefaultFacilityName(), 
                                   GetDefaultRouterName()); 
if (IsFailure(pFacMember != NULL)) 
{ 
cout << "      new RTRFacilityMember failed.\n"; 
return false; 
} 
bArrayAddStatus = ar.Add(pFacMember); 
if (IsFailure(bArrayAddStatus)) 
{ 
cout << "      RTRFacilityMemberArray::Add failed\n"; 
} 
return bArrayAddStatus; 
} 


Clear


RTRFacilityMemberArray::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. This method does not destroy the objects pointed to; the caller must delete the contents.

Example


bool bArrayClearStatus = ar.Clear(); 
 if (IsFailure(bArrayClearStatus)) 
 { 
  cout << "      RTRFacilityMemberArray::Clear failed\n"; 
 } 
 return bArrayClearStatus; 


Insert


RTRFacilityMemberArray::Insert();


Prototype

bool Insert(size_t n, RTRFacilityMember* pFacMember);


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.

pFacMember

A pointer to a facility member.

Description

This method inserts a pointer to an RTRFacility member into the Nth position, moving the remainder of the array to make room.

Example


    bool bArrayInsertStatus; 
    bArrayInsertStatus = ar.Insert(1, pFacMember); 
    if (IsFailure(bArrayInsertStatus)) 
    { 
    cout << "      RTRFacilityMemberArray::Insert failed\n"; 
    } 
    return bArrayInsertStatus; 


operator[]


RTRFacilityMemberArray::GetMemberList();


Prototype

RTRFacilityMember*& operator[] (size_t n);


Return Value

Pointer to the Nth element of the array.

Parameters

n

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

Description

This operator returns the Nth element of the array which is a pointer to an RTRFacility member. You can also use this operator to set the Nth element of the array.

The existing element pointed to is not destroyed; the caller must delete the contents.


Example


RTRFacilityMemberArray array; 
RTRFacilityMember* pFacMember; 
pFacMember = array; 
if (IsFailure(pFacMember != NULL)) 
{ 
cout << "      RTRFacilityMemberArray operator[] failed\n"; 
} 
return pFacMember != NULL; 


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 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.


Previous Next Contents Index