hp Reliable Transaction Router
C++ Foundation Classes


Previous Contents Index


RemoveBackend()


RTRFacilityManager::RemoveBackend();


Prototype


rtr_status_t RemoveBackend( rtr_const_facnam_t pszFacilityName, 
                            rtr_const_nodnam_t pszBackend ); 


Return Value

rtr_status_t Interpret value for the success or failure of this call.
Status Message
RTR_STS_INVBCKENDNAMARG The backend name argument is invalid.
RTR_STS_INVFACNAMEARG The facility name argument is invalid.
RTR_STS_INVFACPROPPTARG Invalid facility properties object pointer argument.
RTR_STS_NOBACKEND No more backends 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.

pszBackend

A null-terminated pointer to a facility member with a backend (BE) role.

Description

Call this method to remove backend node from a facility.

Example


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


RemoveFrontend()


RTRFacilityManager::RemoveFrontend();


Prototype


rtr_status_t RemoveFrontend( rtr_const_facnam_t pszFacilityName, 
                                                 rtr_const_nodnam_t 
pszFrontend ); 


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_INVFRNTENDNMARG The frontend name argument is invalid.
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.

pszFrontend

A null-terminated pointer to a facility member with a frontend (FE) role.

Description

Call this method to remove frontend nodes from a facility.

Example


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


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 provides members that can retrieve information about facilities including member name, role of the member, connectivity to or property of being the local node.

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 pszNodeName, const size_t 
                                                    uiNodeNameSize); 


Return Value

rtr_status_t

Parameters

pszNodeName

A pointer to a nodename.

uiNodeNameSize

An unsigned integer for the member name (nodename) size.

Description

Retrieve the name of the nodename, the facility member.

Example


    #define MAX_NODNAME 256 
    char szNodName[MAX_NODNAME]; 
    rtr_status_t stsGetName = FacMember.GetName(szNodName, MAX_NODNAME); 
    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::operator[]


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; 


Previous Next Contents Index