Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Broker Class Reference

#include <Broker.h>

Collaboration diagram for Broker:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Broker ()
 Broker (const string name)
 ~Broker ()
const int getCounter ()
const string getServerName ()
bool convertDocument (Document &doc)
Result getConversionListing ()
Result getRepresentationTypeListing (string representationType)
Result getFeatureTypeListing (string featureType)

Private Member Functions

void increaseCounter ()
void decreaseCounter ()

Private Attributes

string serverName

Static Private Attributes

int brokerCounter = 0
const string DEFAULT_NAME = "127.0.0.1"

Constructor & Destructor Documentation

Broker::Broker  ) 
 

Definition at line 49 of file Broker.cpp.

References DEFAULT_NAME, increaseCounter(), and serverName.

00050 {
00051     // assign static address and ip.
00052     serverName = DEFAULT_NAME;
00053     Broker::increaseCounter();
00054     return;
00055 }

Here is the call graph for this function:

Broker::Broker const string  name  ) 
 

Definition at line 66 of file Broker.cpp.

References increaseCounter(), and serverName.

00067 {
00068     // assign static address and ip.
00069     serverName = name;
00070     Broker::increaseCounter();
00071     return;
00072 }

Here is the call graph for this function:

Broker::~Broker  ) 
 

Definition at line 82 of file Broker.cpp.

References decreaseCounter().

00083 {
00084     // remove ourselves from the list.
00085     Broker::decreaseCounter();
00086     return;
00087 }

Here is the call graph for this function:


Member Function Documentation

bool Broker::convertDocument Document doc  ) 
 

Definition at line 129 of file Broker.cpp.

References Document::getDocumentConversion(), Server::requestConversion(), and serverName.

Referenced by main(), and DocConversionTestSuite::testConvertDocument().

00130 {
00131     // check if conversion is set.
00132     if ( doc.getDocumentConversion() == "0" )
00133     {
00134 
00135         // conversion has not been set, error out.
00136         cout << "Broker Error: no conversion has been assigned to this Document yet...";
00137         cout << endl;
00138         return false;
00139     }
00140 
00141     // need to have a server now.
00142     Server myConversionServer( serverName );
00143 
00144     if ( !( myConversionServer.requestConversion( doc ) ) )
00145     {
00146         cout << "Broker Error: File was not converted by Server..." << endl;
00147         return false;
00148         ;
00149     }
00150     else
00151     {
00152         return true;
00153     }
00154 }

Here is the call graph for this function:

void Broker::decreaseCounter  )  [private]
 

Definition at line 177 of file Broker.cpp.

References brokerCounter.

Referenced by ~Broker().

00178 {
00179     if ( brokerCounter == 1 )
00180     {
00181         brokerCounter = 0;
00182         return;
00183     }
00184 
00185     brokerCounter--;
00186     return;
00187 }

Result Broker::getConversionListing  ) 
 

Definition at line 205 of file Broker.cpp.

References Server::listConversionDB(), and serverName.

Referenced by main(), and DocConversionTestSuite::testListConversionDB().

00206 {
00207     //
00208     // Just call the server to do the work and assume it works..
00209     //
00210     Server myConversionServer( serverName );
00211     Result myResultsListing = myConversionServer.listConversionDB();
00212     return myResultsListing;
00213 }

Here is the call graph for this function:

const int Broker::getCounter  ) 
 

Definition at line 97 of file Broker.cpp.

References brokerCounter.

Referenced by DocConversionTestSuite::testDecreaseCounter(), DocConversionTestSuite::testGetCounter(), and DocConversionTestSuite::testIncreaseCounter().

00098 {
00099     return brokerCounter;
00100 };

Result Broker::getFeatureTypeListing string  featureType  ) 
 

Definition at line 259 of file Broker.cpp.

References Server::listFeatureTypes(), and serverName.

Referenced by main(), and DocConversionTestSuite::testServerFeatureTypeQuery().

00260 {
00261     //
00262     // Just call the server to do the work and assume it works..
00263     //
00264     Server myConversionServer( serverName );
00265     Result myFeatureTypeListing = myConversionServer.listFeatureTypes( featureType );
00266     return myFeatureTypeListing;
00267 }

Here is the call graph for this function:

Result Broker::getRepresentationTypeListing string  representationType  ) 
 

Definition at line 232 of file Broker.cpp.

References Server::listRepesentationTypes(), and serverName.

Referenced by main(), and DocConversionTestSuite::testServerRepresentationTypeQuery().

00233 {
00234     //
00235     // Just call the server to do the work and assume it works..
00236     //
00237     Server myConversionServer( serverName );
00238     Result myRepTypeListing = myConversionServer.listRepesentationTypes( representationType );
00239     return myRepTypeListing;
00240 }

Here is the call graph for this function:

const string Broker::getServerName  ) 
 

Definition at line 111 of file Broker.cpp.

References serverName.

Referenced by DocConversionTestSuite::testBrokerRemoteServer().

00112 {
00113     return serverName;
00114 }

void Broker::increaseCounter  )  [private]
 

Definition at line 164 of file Broker.cpp.

References brokerCounter.

Referenced by Broker().

00165 {
00166     brokerCounter++;
00167 }


Member Data Documentation

int Broker::brokerCounter = 0 [static, private]
 

Definition at line 37 of file Broker.cpp.

Referenced by decreaseCounter(), getCounter(), and increaseCounter().

const string Broker::DEFAULT_NAME = "127.0.0.1" [static, private]
 

Definition at line 38 of file Broker.cpp.

Referenced by Broker().

string Broker::serverName [private]
 

Definition at line 164 of file Broker.h.

Referenced by Broker(), convertDocument(), getConversionListing(), getFeatureTypeListing(), getRepresentationTypeListing(), and getServerName().


The documentation for this class was generated from the following files:
Generated on Thu Dec 4 14:39:19 2003 for docconversion.kdevelop by doxygen 1.3.4