MCSB  2.0.0
High-throughput shared memory middleware
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | List of all members
MCSB::ClientOptions Struct Reference

An options/parameters class for constructing an MCSB Client. More...

#include <MCSB/ClientOptions.h>

Public Types

enum  {
  kDefaultMinProducerBytes = (8*1024*1024), kDefaultMinConsumerBytes = (8*1024*1024), kDefaultMinProducerSlabs = 4, kDefaultMinConsumerSlabs = 4,
  kDefaultVerbosity = kNotice, kDefaultProducerNiceLevel = 0
}
 The default values for most of the client options.
 
enum  CrcPolicy {
  eNoCrcs = 0, eSetCrcs = 1, eVerifyCrcs = 2, eSetAndVerifyCrcs = 3,
  eDefaultCrcs = eNoCrcs, kDefaultCrcPolicy = eDefaultCrcs, eDefaultCrcStr = 4, eUnknownCrcStr = 5
}
 Values for client-side message CRC computation and verification. More...
 

Public Member Functions

 ClientOptions (const char *argv0=0, const char *usage="")
 Construct with all default parameters.
 
 ClientOptions (int argc, char *const argv[], const char *usage="")
 Construct with built-in parsing of argc and argv.
 
CrcPolicy SetCrcPolicy (const char *crcPolicyStr)
 Set the CRC Policy from a string ["OFF", "SET", "VERIFY", "ON", "DEFAULT"].
 
const char * CrcPolicyStr (void) const
 Get the current CRC Policy as a string.
 
int Parse (int argc, char *const argv[])
 Parse argc and argv to fill out this ClientOptions struct.
 
void Print (const char *prefix="", FILE *f=stderr) const
 Print this ClientOptions struct (with a prefix) to the specified file stream.
 
const std::string & SetDefaultCtrlSocketName (void)
 Set this ClientOptions to use the default control socket name.
 
const std::string & SetDefaultClientName (const char *argv0=0)
 Set this ClientOptions to use the default client name.
 

Static Public Member Functions

static const char * CrcPolicyStr (CrcPolicy crcPolicy)
 Get a CRC Policy string from a CrcPolicy.
 
static const char * DefaultCrcStr (void)
 Get a string for the default CrcPolicy.
 
static std::string SubstituteUsername (const char *fmt)
 Utility function which substitutes U for the username.
 
static const std::string & SetDefaultCtrlSocketName (std::string &s)
 Assign to a string and return the default control socket name.
 
static const std::string & SetDefaultClientName (std::string &s, const char *argv0=0)
 Assign to a string and return the default client name, based on the program name.
 

Public Attributes

size_t minProducerBytes
 min number of bytes for producing messages
 
size_t minConsumerBytes
 min number of bytes for consuming messages
 
uint32_t minProducerSlabs
 min number of slabs for producing messages
 
uint32_t minConsumerSlabs
 min number of slabs for producing messages
 
std::string ctrlSockName
 name of control socket to connect to Manager
 
std::string clientName
 name of Client, to report to Manager
 
char verbosity
 Client verbosity level.
 
char producerNiceLevel
 producer niceness (playback/non-realtime mode)
 
CrcPolicy crcPolicy
 policy on computing/verifying message CRCs
 

Protected Types

typedef int(* XOptCB )(int opt, const char *optarg, void *user)
 Extra option callback type (advanced), for use with protected Parse below.
 

Protected Member Functions

void PrintUsage (const char *argv0, FILE *f=stderr)
 Print a usage message to the specified file stream.
 
int Parse (int argc, char *const argv[], const char *xtraOpts, XOptCB xocbFunc=0, void *user=0)
 Parse argc and argv, calling back xocbFunc if xtraOpts are encountered (advanced).
 

Detailed Description

An options/parameters class for constructing an MCSB Client.

ClientOptions is used to construct a Client. It tells the Client how to connect to a Manager, how much memory to allocate for message communication, whether to compute CRCs, etc. ClientOptions also has rudimentary command-line parsing built in so that MCSB can be built and tested without libvariant. However, for beefy command-line parsing use VariantClientOptions.

See Also
VariantClientOptions.h

Member Enumeration Documentation

Values for client-side message CRC computation and verification.

Enumerator
eNoCrcs 

Do not set or verify CRCs on any message.

eSetCrcs 

Set CRCs (on send), but do not verify (on recv).

eVerifyCrcs 

Verify CRCs (on recv), but do set (on send).

eSetAndVerifyCrcs 

Set and verify CRCs on all messages.

eDefaultCrcs 

The default CRC policy (eNoCrcs).

kDefaultCrcPolicy 

The default CRC policy.


The documentation for this struct was generated from the following file: