Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ArServerSimpleOpener Class Reference

Set up and open an ArNetworking server. More...

#include <ArServerSimpleOpener.h>

List of all members.

Public Member Functions

 ArServerSimpleOpener (ArArgumentParser *parser, const char *prefix="")
 Constructor.
bool checkAndLog (void) const
 Logs the things requested for logging, may check things later.
bool didOpenFail (void)
 Returns true if the open failed because it couldn't open.
int getPort ()
 Get the server's port number.
void logOptions (void) const
 Log the options the simple connector has.
bool open (ArServerBase *server, const char *baseDirectory="", int secondsToTryFor=240)
 Function to open up the server.
bool parseArgs (ArArgumentParser *parser)
 Function to parse the arguments given in an arbitrary parser.
bool parseArgs (void)
 Function to parse the arguments given in the constructor.
bool parseFile (const char *fileName)
 Parses the file for holding the server key.
bool wasUserFileBad (void)
 Returns true if the open failed because of a bad user file.
 ~ArServerSimpleOpener ()
 Destructor.

Protected Member Functions

bool fileServerKeyCallback (ArArgumentBuilder *arg)
void logOptionsWithOutPrefix (void) const
void logOptionsWithPrefix (void) const
bool parseArgsWithOutPrefix (ArArgumentParser *parser)
bool parseArgsWithPrefix (ArArgumentParser *parser)
void reset (void)

Protected Attributes

bool myBadUserFile
ArFileParser myFileParser
ArRetFunctor1C< bool, ArServerSimpleOpener,
ArArgumentBuilder * > 
myFileServerKeyCB
bool myLogCommandGroups
ArConstFunctorC< ArServerSimpleOpenermyLogOptionsCB
bool myLogUserInfo
bool myOpenFailed
const char * myOpenOnIP
bool myOwnParser
ArRetFunctorC< bool, ArServerSimpleOpenermyParseArgsCB
ArArgumentParsermyParser
std::string myPrefix
ArServerBasemyServer
std::string myServerKey
int myServerPort
const char * myUserFile


Detailed Description

Set up and open an ArNetworking server.

These options are taken from the command line arguments: To set the port the server uses use '-serverPort serverPortNumber' or '-sp serverPortNumber'. To set the file to look in for user information use '-userInfo fileName' or "-ui fileName'. To log out the user information use '-logUserInfo' or 'lui'. To log out the command groups use '-logCommandGroups' or '-lcg'. To set the key used for the server (that the client has to know to connect if using user and password) use '-serverInfoFile file'. With a file that has in it 'serverKey <serverkey>'. You should obviously make sure no one you don't want to know that server key can read your file that it is in.

For more details about all of these options see ArServerBase.

See also:
ArServerBase
Examples:

drawingsExampleWithRobot.cpp, popupExample.cpp, serverDemo.cpp, and simpleServerExample.cpp.

Definition at line 53 of file ArServerSimpleOpener.h.


Constructor & Destructor Documentation

ArServerSimpleOpener::ArServerSimpleOpener ArArgumentParser parser,
const char *  prefix = ""
 

Constructor.

Parameters:
parser the parser to use for information

Definition at line 35 of file ArServerSimpleOpener.cpp.

References ArFileParser::addHandler(), Aria::addLogOptionsCB(), Aria::addParseArgsCB(), myFileParser, myFileServerKeyCB, myLogCommandGroups, myLogOptionsCB, myLogUserInfo, myOpenOnIP, myOwnParser, myParseArgsCB, myParser, myPrefix, myServer, myServerPort, myUserFile, and ArFunctor::setName().

ArServerSimpleOpener::~ArServerSimpleOpener  ) 
 

Destructor.

Definition at line 67 of file ArServerSimpleOpener.cpp.


Member Function Documentation

bool ArServerSimpleOpener::checkAndLog void   )  const
 

Logs the things requested for logging, may check things later.

Definition at line 283 of file ArServerSimpleOpener.cpp.

References ArServerBase::logCommandGroups(), ArServerBase::logUserInfo(), myLogCommandGroups, myLogUserInfo, and myServer.

Referenced by main().

bool ArServerSimpleOpener::didOpenFail void   )  [inline]
 

Returns true if the open failed because it couldn't open.

Definition at line 75 of file ArServerSimpleOpener.h.

References myOpenFailed.

bool ArServerSimpleOpener::fileServerKeyCallback ArArgumentBuilder arg  )  [protected]
 

Definition at line 295 of file ArServerSimpleOpener.cpp.

References ArLog::log(), and myServerKey.

int ArServerSimpleOpener::getPort void   )  [inline]
 

Get the server's port number.

Returns:
the server's port number

Definition at line 79 of file ArServerSimpleOpener.h.

References myServerPort.

Referenced by main().

void ArServerSimpleOpener::logOptions void   )  const
 

Log the options the simple connector has.

Definition at line 175 of file ArServerSimpleOpener.cpp.

References logOptionsWithOutPrefix(), logOptionsWithPrefix(), and myPrefix.

Referenced by main().

void ArServerSimpleOpener::logOptionsWithOutPrefix void   )  const [protected]
 

Definition at line 183 of file ArServerSimpleOpener.cpp.

References ArLog::log().

Referenced by logOptions().

void ArServerSimpleOpener::logOptionsWithPrefix void   )  const [protected]
 

Definition at line 205 of file ArServerSimpleOpener.cpp.

References ArLog::log(), and myPrefix.

Referenced by logOptions().

bool ArServerSimpleOpener::open ArServerBase server,
const char *  baseDirectory = "",
int  secondsToTryFor = 240
 

Function to open up the server.

Parameters:
server the server to operate on
baseDirectory the base directory (solely for loading user information)
secondsToTryFor this is the number of seconds to try opening for, 0 means only try to open once

Definition at line 234 of file ArServerSimpleOpener.cpp.

References ArLog::log(), myBadUserFile, myOpenFailed, myOpenOnIP, myServer, myServerKey, myServerPort, myUserFile, ArTime::secSince(), ArTime::setToNow(), and ArUtil::sleep().

Referenced by main().

bool ArServerSimpleOpener::parseArgs ArArgumentParser parser  ) 
 

Function to parse the arguments given in an arbitrary parser.

Definition at line 77 of file ArServerSimpleOpener.cpp.

References myPrefix, parseArgsWithOutPrefix(), and parseArgsWithPrefix().

bool ArServerSimpleOpener::parseArgs void   ) 
 

Function to parse the arguments given in the constructor.

Definition at line 72 of file ArServerSimpleOpener.cpp.

References myParser.

Referenced by main().

bool ArServerSimpleOpener::parseArgsWithOutPrefix ArArgumentParser parser  )  [protected]
 

Definition at line 86 of file ArServerSimpleOpener.cpp.

References ArArgumentParser::checkParameterArgumentString(), myLogCommandGroups, myLogUserInfo, myOpenOnIP, myParser, myServerPort, myUserFile, and parseFile().

Referenced by parseArgs().

bool ArServerSimpleOpener::parseArgsWithPrefix ArArgumentParser parser  )  [protected]
 

Definition at line 135 of file ArServerSimpleOpener.cpp.

References ArArgumentParser::checkParameterArgumentStringVar(), myLogCommandGroups, myLogUserInfo, myOpenOnIP, myParser, myPrefix, myServerPort, myUserFile, and parseFile().

Referenced by parseArgs().

bool ArServerSimpleOpener::parseFile const char *  fileName  ) 
 

Parses the file for holding the server key.

Definition at line 310 of file ArServerSimpleOpener.cpp.

References ArLog::log(), myFileParser, and ArFileParser::parseFile().

Referenced by parseArgsWithOutPrefix(), and parseArgsWithPrefix().

void ArServerSimpleOpener::reset void   )  [protected]
 

bool ArServerSimpleOpener::wasUserFileBad void   )  [inline]
 

Returns true if the open failed because of a bad user file.

Definition at line 73 of file ArServerSimpleOpener.h.

References myBadUserFile.

Referenced by main().


Member Data Documentation

bool ArServerSimpleOpener::myBadUserFile [protected]
 

Definition at line 100 of file ArServerSimpleOpener.h.

Referenced by open(), and wasUserFileBad().

ArFileParser ArServerSimpleOpener::myFileParser [protected]
 

Definition at line 108 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), and parseFile().

ArRetFunctor1C<bool, ArServerSimpleOpener, ArArgumentBuilder *> ArServerSimpleOpener::myFileServerKeyCB [protected]
 

Definition at line 112 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener().

bool ArServerSimpleOpener::myLogCommandGroups [protected]
 

Definition at line 99 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), checkAndLog(), parseArgsWithOutPrefix(), and parseArgsWithPrefix().

ArConstFunctorC<ArServerSimpleOpener> ArServerSimpleOpener::myLogOptionsCB [protected]
 

Definition at line 110 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener().

bool ArServerSimpleOpener::myLogUserInfo [protected]
 

Definition at line 98 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), checkAndLog(), parseArgsWithOutPrefix(), and parseArgsWithPrefix().

bool ArServerSimpleOpener::myOpenFailed [protected]
 

Definition at line 101 of file ArServerSimpleOpener.h.

Referenced by didOpenFail(), and open().

const char* ArServerSimpleOpener::myOpenOnIP [protected]
 

Definition at line 96 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), open(), parseArgsWithOutPrefix(), and parseArgsWithPrefix().

bool ArServerSimpleOpener::myOwnParser [protected]
 

Definition at line 104 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener().

ArRetFunctorC<bool, ArServerSimpleOpener> ArServerSimpleOpener::myParseArgsCB [protected]
 

Definition at line 109 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener().

ArArgumentParser* ArServerSimpleOpener::myParser [protected]
 

Definition at line 103 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), parseArgs(), parseArgsWithOutPrefix(), and parseArgsWithPrefix().

std::string ArServerSimpleOpener::myPrefix [protected]
 

Definition at line 105 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), logOptions(), logOptionsWithPrefix(), parseArgs(), and parseArgsWithPrefix().

ArServerBase* ArServerSimpleOpener::myServer [protected]
 

Definition at line 97 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), checkAndLog(), and open().

std::string ArServerSimpleOpener::myServerKey [protected]
 

Definition at line 94 of file ArServerSimpleOpener.h.

Referenced by fileServerKeyCallback(), and open().

int ArServerSimpleOpener::myServerPort [protected]
 

Definition at line 95 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), getPort(), open(), parseArgsWithOutPrefix(), and parseArgsWithPrefix().

const char* ArServerSimpleOpener::myUserFile [protected]
 

Definition at line 92 of file ArServerSimpleOpener.h.

Referenced by ArServerSimpleOpener(), open(), parseArgsWithOutPrefix(), and parseArgsWithPrefix().


The documentation for this class was generated from the following files:
Generated on Tue Feb 20 10:51:52 2007 for ArNetworking by  doxygen 1.4.0