MCS
0.3.3-alpha7
|
Namespace for MCS library. More...
Classes | |
class | B64_Codec |
A Base 64 encoder/decoder. More... | |
class | BaseThread |
Base class for MCS threaded objects. More... | |
class | Buffer |
High level buffer. More... | |
class | Client |
Connect to a MCS server as a client. More... | |
class | ClientInfo |
Class holding information about a client connection. More... | |
class | CommandParser |
Parse command lines. More... | |
class | Conf |
Read and write configuration files. More... | |
class | Data |
A general purpose data type. More... | |
class | DateTime |
A class to hold date time information. More... | |
class | DBConn |
Handle database connection. More... | |
class | Dynamic_Array |
A thread safe, template class to handle an array of objects. More... | |
class | Env |
Hold all environment variables. More... | |
class | Event |
Hold informations about an event. More... | |
class | FITSReader |
Read a FITS file. More... | |
class | FITSWriter |
Write a fits file. More... | |
class | HostInfo |
Retrieve informations about a network host. More... | |
class | LocalThread |
Server side administrative thread. More... | |
class | NetInterface |
Retrieve informations about network interfaces. More... | |
class | Pipe |
A high level class to use system pipes. More... | |
class | Query |
Execute queries on the database. More... | |
class | Record |
A dynamic array of Data objects. More... | |
class | RecordSet |
The base class that implement the data abstraction layer. More... | |
class | Serializable |
Serialize memory buffers or files into chunks. More... | |
class | Server |
Main server class for a MCS-based application. More... | |
class | ServerSocket |
Manage TCP server sockets. More... | |
class | Socket |
Manage TCP sockets. More... | |
class | Synchro |
A simple class to implement "critical sections". More... | |
class | Table |
A class to directly set and retrieve value from a database table. More... | |
class | Thread |
A class to create separate threads. More... | |
class | ThreadFunc |
class | ThreadSpecificData |
class | UserThread |
The server side client thread. More... | |
Typedefs | |
typedef enum Types | Types |
Enumerations | |
enum | BufferFreeOnDestroy { AUTO_FREE, DONT_FREE } |
Values to be used in Buffer class constructor. More... | |
enum | RetValue { OK, WARN, ERROR, FATAL } |
Return value for MCS routines. More... | |
enum | ThrowExceptions { DONT_THROW, THROW } |
Values to be used with throwexc parameters. More... | |
enum | TimeMode { UTC, LOCAL } |
Enumerate operational mode for a DateTime object. More... | |
enum | Types { TINY, SMALL, MEDIUM, INT, BIGINT, FLOAT, DOUBLE, STRING, TIME, TINY_BLOB, BLOB, POINTER } |
Enumeration of base type for Data. More... | |
Functions | |
string | btos (bool b) |
Convert a boolean to a string containing "true" or "false". More... | |
string | chomp (string s) |
Remove any trailing newlines. More... | |
int | copy (char *OLDNAME, char *NEWNAME) |
Copy a file from OLDNAME to NEWNAME. More... | |
string | dtos (double f) |
Convert an floating point number to a string. More... | |
int | extractCode (const char *msg) |
Extract the numeric code from a server reply. More... | |
bool | File_Dir_Exist (string fn, unsigned int &size) |
Check if a file or directory exists. More... | |
bool | FITS2Types (int fits, Types &dbt, bool &isunsigned) |
Convert a FITSIO type into a MCS type. More... | |
string | fitsError (int status) |
Return a description of a FITS error. More... | |
bool | FloatType (Types type) |
Tell if "type" is a float type. More... | |
string | hexDump (const void *buf, unsigned int size) |
Return a string with an hex dump of the buffer pointed by "buf", with a length of "size". More... | |
bool | IntType (Types type) |
Tell if "type" is an integer type. More... | |
string | itos (int i) |
Convert an integer to a string. More... | |
void | ls2Record (string fn, Record &v) |
Fill a vector with a list of file. More... | |
Env * | mcsStart (string appname, string inipath="", Server *(*cb_newServer)(Env *)=NULL) |
Start a MCS server. More... | |
bool | mkDir (string path, mode_t perm=0, enum ThrowExceptions throwexc=THROW) |
Create a directory. More... | |
int | move (char *OLDNAME, char *NEWNAME) |
Move a file from OLDNAME to NEWNAME. More... | |
time_t | my_timelocal (struct tm *tm) |
string | MYSQL2Str (enum_field_types type) |
Return the name of the MySQL type given in "type". More... | |
bool | MYSQL2Types (enum_field_types mtype, Types &type) |
Convert a MySQL type into a MCS type. More... | |
string | Pwd () |
Return the current working dir. More... | |
mode_t | read_umask () |
Read the file creation mask of the current process. More... | |
string | remLeading (string &s, const char *p) |
Remove any leading character "p". More... | |
string | remTabs (string s) |
Remove any tab. More... | |
string | remTrailing (string &s, const char *p) |
Remove any trailing character "p". More... | |
bool | rmDir (string path, enum ThrowExceptions throwexc=THROW) |
Removes a directory. More... | |
int | Select (int fd, unsigned int sec_timeout, unsigned int usec_timeout, int op) |
int | Select (int fd[], int nfd, unsigned int sec_timeout, unsigned int usec_timeout, int op) |
void | sleep_ms (unsigned int millisec) |
A millisecond resolution sleep function. More... | |
vector< string > | split (string s, string sep=" ") |
Split a string into tokens. More... | |
int | stoi (string s) |
Convert a string to an integer. More... | |
int | stoi (string s, int errval) |
Convert a string to an integer. More... | |
string | subst (string s, string what, string with, int op=0) |
Perform substitutions on a string. More... | |
string | trim (string s) |
Remove any leading or trailing blanks. More... | |
bool | Types2FITS (Types dbt, bool isunsigned, int &fits) |
Convert a MCS type into a FITSIO type. More... | |
bool | Types2MYSQL (Types &type, enum_field_types &mtype) |
Convert a MCS type into a MySQL type. More... | |
string | Types2MYSQLStr (Types &type, bool isunsigned) |
Convert a MCS type into a MySQL type. More... | |
bool | Types2S_FITS (Types dbt, int len, bool isunsigned, string &fits) |
Convert a MCS type into a FITSIO type code. More... | |
string | Types2Str (Types type, bool isunsigned) |
Return the name of the type given in "type" and "isunsigned". More... | |
bool | VarLenType (Types type) |
Tell if "type" is a variable length type. More... | |
string | vtos (vector< string > vec) |
Join a vector of strings in a single string using newlines. More... | |
Namespace for MCS library.
The namespace "mcs" contains all classes, functions and type declarations provided by the mcs library. Those names that cannot be protected inside namespaces, like symbols and macros, has the "MCS_" prefix.
enum mcs::RetValue |
Return value for MCS routines.
This enumeration is often used as a return value for a function or method. It says if the function executed correctly (value OK) or not (values WARN, ERROR, FATAL). This enumeration is also used to specify an event type (see the Event class), which are also used to throw exceptions.
The three values for errors should be used following this rule:
Enumerator | |
---|---|
OK | No error. |
WARN | Warning. |
ERROR | Application error. |
FATAL | Fatal error. |
enum mcs::ThrowExceptions |
enum mcs::TimeMode |
enum mcs::Types |
Enumeration of base type for Data.
string mcs::btos | ( | bool | b | ) |
string mcs::chomp | ( | string | s | ) |
int mcs::copy | ( | char * | OLDNAME, |
char * | NEWNAME | ||
) |
Copy a file from OLDNAME to NEWNAME.
OLDNAME must be an absolute or relative path with a filename.
NEWNAME can be an absolute or relative path with or without a filename (the file will be copied with its original name).
Return 0 if successfull, otherwise return -1. In case of error a message will be printed in stderr.
string mcs::dtos | ( | double | f | ) |
int mcs::extractCode | ( | const char * | msg | ) |
bool mcs::File_Dir_Exist | ( | string | fn, |
unsigned int & | size | ||
) |
bool mcs::FITS2Types | ( | int | fits, |
Types & | dbt, | ||
bool & | isunsigned | ||
) |
string mcs::fitsError | ( | int | status | ) |
Return a description of a FITS error.
Definition at line 438 of file Readers.cc.
bool mcs::FloatType | ( | Types | type | ) |
string mcs::hexDump | ( | const void * | buf, |
unsigned int | size | ||
) |
bool mcs::IntType | ( | Types | type | ) |
void mcs::ls2Record | ( | string | fn, |
Record & | v | ||
) |
Start a MCS server.
This function start a MCS Server (or a derived object) creating the necessary Env object, and eventually catching exceptions. If an exception is raised the message will be written on standard error.
This funtion return the address of an Env object, or NULL if an error occurred. The Env object needs to be destroyed when the program exit.
A typical use of this function is in the main program, you can start a MCS server without derived classses with the following code:
Instead, if you implemented some derived classes, you should change the code as follows:
The mcsCustomStart() function has been implemented by the call to the MCS_CUSTOM_SERVER macro.
appname | Application name, will be passed to the Env constructor. |
inipath | Configuration file path, will be passed to the Env constructor. |
bool mcs::mkDir | ( | string | path, |
mode_t | perm = 0 , |
||
enum ThrowExceptions | throwexc = THROW |
||
) |
int mcs::move | ( | char * | OLDNAME, |
char * | NEWNAME | ||
) |
Move a file from OLDNAME to NEWNAME.
OLDNAME must be an absolute or relative path with a filename.
NEWNAME can be an absolute or relative path with or without a filename (the file will be copied with its original name). If a relative path wich uses only the "." or ".." paths and without a filename is used then it MUST terminates with a slash "/".
Return 0 if successfull, otherwise return -1. In case of error a message will be printed in stderr.
string mcs::MYSQL2Str | ( | enum_field_types | type | ) |
bool mcs::MYSQL2Types | ( | enum_field_types | mtype, |
Types & | type | ||
) |
mode_t mcs::read_umask | ( | ) |
string mcs::remLeading | ( | string & | s, |
const char * | p | ||
) |
string mcs::remTrailing | ( | string & | s, |
const char * | p | ||
) |
bool mcs::rmDir | ( | string | path, |
enum ThrowExceptions | throwexc = THROW |
||
) |
void mcs::sleep_ms | ( | unsigned int | millisec | ) |
std::vector< std::string > mcs::split | ( | string | s, |
string | sep = " " |
||
) |
int mcs::stoi | ( | string | s | ) |
int mcs::stoi | ( | string | s, |
int | errval | ||
) |
string mcs::subst | ( | string | s, |
string | what, | ||
string | with, | ||
int | op = 0 |
||
) |
Perform substitutions on a string.
Substitutes "what" with "with" in the string "s" and return the result. The "what" parameter is intended as a regular expression. The parameter "op" can be one or more of MCS_SUBST_QUOTE_WITH, MCS_SUBST_LEADING, MCS_SUBST_TRAILING.
string mcs::trim | ( | string | s | ) |
bool mcs::Types2FITS | ( | Types | dbt, |
bool | isunsigned, | ||
int & | fits | ||
) |
bool mcs::Types2MYSQL | ( | Types & | type, |
enum_field_types & | mtype | ||
) |
string mcs::Types2MYSQLStr | ( | Types & | type, |
bool | isunsigned | ||
) |
bool mcs::Types2S_FITS | ( | Types | dbt, |
int | len, | ||
bool | isunsigned, | ||
string & | fits | ||
) |
string mcs::Types2Str | ( | Types | type, |
bool | isunsigned | ||
) |
bool mcs::VarLenType | ( | Types | type | ) |
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha7
|