coil Namespace Reference

Common Object Interface Layer. More...


Classes

class  Allocator
class  Async
class  Async_t
class  Async_ref_t
class  Condition
class  DynamicLib
class  Factory
class  GlobalFactory
class  Guard
class  log_streambuf
class  log_stream
class  default_deleter
class  refcounter_base
class  refcounter
class  shared_ptr
class  Mutex
class  NonCopyable
 Non-copyable Mixin. More...
class  NonCopyableCRTP
class  GetOpt
class  PeriodicTask
class  TaskFuncBase
class  TaskFunc
class  PeriodicTaskBase
class  Properties
 Class represents a set of properties. More...
class  SignalAction
class  Singleton
class  Task
class  TimeMeasure
class  Timer
 Timer class. More...
class  TimeValue

Typedefs

typedef log_streambuf< char > LogStreamBuffer
typedef log_stream< char > LogStream
typedef ::utsname utsname
typedef ::pid_t pid_t
typedef void(* SignalHandler )(int)
typedef std::vector< std::string > vstring

Functions

template<typename Object, typename Func>
Async_t< Object, Func > * AsyncInvoker (Object *obj, Func func, bool auto_delete=false)
template<typename Object, typename Func>
Async_ref_t< Object, Func > * AsyncInvoker (Object *obj, Func *func, bool auto_delete=false)
template<class AbstractClass, class ConcreteClass>
AbstractClass * Creator ()
template<class AbstractClass, class ConcreteClass>
void Destructor (AbstractClass *&obj)
std::string dirname (char *path)
std::string basename (const char *path)
coil::vstring filelist (const char *path, const char *glob_str="")
template<class T, class U>
bool operator== (shared_ptr< T > const &a, shared_ptr< U > const &b)
template<class T, class U>
bool operator!= (shared_ptr< T > const &a, shared_ptr< U > const &b)
template<class T, class U>
bool operator< (shared_ptr< T > const &a, shared_ptr< U > const &b)
template<class E, class T, class Y>
basic_ostream< E, T > & operator<< (basic_ostream< E, T > &os, shared_ptr< Y > const &p)
template<class T>
void swap (shared_ptr< T > &a, shared_ptr< T > &b)
template<class T, class U>
shared_ptr< T > static_pointer_cast (shared_ptr< U > const &r)
template<class T, class U>
shared_ptr< T > dynamic_pointer_cast (shared_ptr< U > const &r)
template<class T, class U>
shared_ptr< T > const_pointer_cast (shared_ptr< U > const &r)
template<class D, class T>
D * get_deleter (shared_ptr< T > const &p)
int uname (utsname *name)
pid_t getpid ()
pid_t getppid ()
char * getenv (const char *name)
int launch_shell (std::string command)
 Launching a process.
int daemon (int nochdir, int noclose)
bool dest_to_endpoint (std::string dest_addr, std::string &endpoint)
 Getting network interface name from destination address.
bool find_dest_ifname (std::string dest_addr, std::string &dest_if)
 Getting network interface name from destination address.
bool ifname_to_ipaddr (std::string ifname, std::string &ipaddr)
 Get IP address from a network interface name.
std::wstring string2wstring (std::string str)
 string to wstring conversion
std::string wstring2string (std::wstring wstr)
 wstring to string conversion
void toUpper (std::string &str)
 Uppercase String Transformation.
void toLower (std::string &str)
 Lowercase String Transformation.
int getlinePortable (std::istream &istr, std::string &line)
 Read a line from input stream.
bool isEscaped (const std::string &str, std::string::size_type pos)
 Check whether the character is escaped or not.
std::string escape (const std::string str)
 Escape string.
std::string unescape (const std::string str)
 Unescape string.
void eraseBlank (std::string &str)
 Erase blank characters of string.
void eraseHeadBlank (std::string &str)
 Erase the head blank characters of string.
void eraseTailBlank (std::string &str)
 Erase the tail blank characters of string.
void eraseBothEndsBlank (std::string &str)
 Erase the head blank and the tail blank characters of string.
std::string normalize (std::string &str)
 Erase the head/tail blank and replace upper case to lower case.
void replaceString (std::string &str, const std::string from, const std::string to)
 Replace string.
vstring split (const std::string &input, const std::string &delimiter, bool ignore_empty=false)
 Split string by delimiter.
bool toBool (std::string str, std::string yes, std::string no, bool default_value=true)
 Convert given string into bool value.
bool includes (const vstring &list, std::string value, bool ignore_case=true)
 Include if a string is included in string list.
bool includes (const std::string &list, std::string value, bool ignore_case=true)
bool isAbsolutePath (const std::string &str)
 Investigate whether the given string is absolute path or not.
bool isURL (const std::string &str)
 Investigate whether the given string is URL or not.
template<class Printable>
std::string otos (Printable n)
 Convert the given object to std::string.
template<typename To>
bool stringTo (To &val, const char *str)
 Convert the given std::string to object.
template<>
bool stringTo< std::string > (std::string &val, const char *str)
vstring unique_sv (vstring sv)
 Eliminate duplication from the given string list.
std::string flatten (vstring sv)
 Create CSV file from the given string list.
char ** toArgv (const vstring &args)
 Convert the given string list into the argument list.
std::string sprintf (char const *__restrict fmt,...)
unsigned int sleep (unsigned int seconds)
int sleep (TimeValue interval)
int usleep (useconds_t usec)
int gettimeofday (struct timeval *tv, struct timezone *tz)
TimeValue gettimeofday ()
int settimeofday (const struct timeval *tv, const struct timezone *tz)


Detailed Description

Common Object Interface Layer.

Typedef Documentation

typedef log_stream<char> coil::LogStream

typedef ::pid_t coil::pid_t

typedef void(* coil::SignalHandler)(int)

typedef std::vector<std::string> coil::vstring


Function Documentation

template<typename Object, typename Func>
Async_ref_t<Object, Func>* coil::AsyncInvoker ( Object *  obj,
Func *  func,
bool  auto_delete = false 
) [inline]

template<typename Object, typename Func>
Async_t<Object, Func>* coil::AsyncInvoker ( Object *  obj,
Func  func,
bool  auto_delete = false 
) [inline]

std::string coil::basename ( const char *  path  )  [inline]

template<class T, class U>
shared_ptr<T> coil::const_pointer_cast ( shared_ptr< U > const &  r  )  [inline]

template<class AbstractClass, class ConcreteClass>
AbstractClass* coil::Creator (  )  [inline]

int coil::daemon ( int  nochdir,
int  noclose 
)

bool coil::dest_to_endpoint ( std::string  dest_addr,
std::string &  endpoint 
)

Getting network interface name from destination address.

This operation returns IP address of a endpoint to be used to communicate with the given destination address. IP address and FQDN hostname are available for the destination address dest_addr. If a destination address are reachable and an endpoint IP address is available, this operation returns true, and otherwise false.

Parameters:
dest_addr a destination address or host name
endpoint a IP address of the endpoint to be used to communicate with the destination address
Returns:
successful: true, failed: false

template<class AbstractClass, class ConcreteClass>
void coil::Destructor ( AbstractClass *&  obj  )  [inline]

std::string coil::dirname ( char *  path  )  [inline]

template<class T, class U>
shared_ptr<T> coil::dynamic_pointer_cast ( shared_ptr< U > const &  r  )  [inline]

void coil::eraseBlank ( std::string &  str  ) 

Erase blank characters of string.

Erase blank characters that exist at the head of the given string. Space ' 'and tab '\t' are supported as the blank character.

Parameters:
str The target blank characters of string for the erase

void coil::eraseBothEndsBlank ( std::string &  str  ) 

Erase the head blank and the tail blank characters of string.

Erase the head blank characters and the blank characters that exist at the tail of the given string. Space ' 'and tab '\t' are supported as the blank character.

Parameters:
str The target tail blank characters of string for the erase

void coil::eraseHeadBlank ( std::string &  str  ) 

Erase the head blank characters of string.

Erase the blank characters that exist at the head of the given string. Space ' 'and tab '\t' are supported as the blank character.

Parameters:
str The target head blank characters of string for the erase

void coil::eraseTailBlank ( std::string &  str  ) 

Erase the tail blank characters of string.

Erase the blank characters that exist at the tail of the given string. Space ' 'and tab '\t' are supported as the blank character.

Parameters:
str The target tail blank characters of string for the erase

std::string coil::escape ( const std::string  str  ) 

Escape string.

The following characters are converted.
HT -> "\t"
LF -> "\n"
CR -> "\r"
FF -> "\f"
Single quote and double quote are not processed.

Parameters:
str The target string for the escape
Returns:
Result string of the escape

coil::vstring coil::filelist ( const char *  path,
const char *  glob_str = "" 
) [inline]

bool coil::find_dest_ifname ( std::string  dest_addr,
std::string &  dest_if 
)

Getting network interface name from destination address.

This operation returns network interface name to be used to communicate with the given destination address. IP address and FQDN hostname are available for the destination address dest_addr. Returned dest_if means the network interface name. If a destination address are reachable and network interface name is available, this operation returns true, and otherwise false.

Parameters:
dest_addr a destination address or host name
dest_if a network interface name to be used to communicate with the destination address
Returns:
successful: true, failed: false

std::string coil::flatten ( vstring  sv  ) 

Create CSV file from the given string list.

Create CSV that arranged each element of the character string list given by the argument. If the string list is empty, the null will be returned.

Parameters:
sv The target string list for creating CSV
Returns:
String of CSV creating result

template<class D, class T>
D* coil::get_deleter ( shared_ptr< T > const &  p  )  [inline]

char* coil::getenv ( const char *  name  )  [inline]

int coil::getlinePortable ( std::istream &  istr,
std::string &  line 
)

Read a line from input stream.

This function reads a line from input stream. UNIX, Windows or mixed line feed code is acceptable.

Parameters:
istr The input stream.
line The output variable to store string to be read.
Returns:
The length of read string except line feed character.

pid_t coil::getpid (  )  [inline]

pid_t coil::getppid (  )  [inline]

TimeValue coil::gettimeofday (  )  [inline]

References gettimeofday().

Referenced by gettimeofday().

int coil::gettimeofday ( struct timeval *  tv,
struct timezone *  tz 
) [inline]

References gettimeofday().

Referenced by gettimeofday(), and setTimestamp().

bool coil::ifname_to_ipaddr ( std::string  ifname,
std::string &  ipaddr 
)

Get IP address from a network interface name.

This operation returns IP address which is assigned with the given network interface. If IP address could be obtained from the network interface name, this operation returns true, otherwise false.

Parameters:
ifname a network interface name
ipaddr IP address that is assigned to the network interface
Returns:
successful: true, failed: false

bool coil::includes ( const std::string &  list,
std::string  value,
bool  ignore_case = true 
)

bool coil::includes ( const vstring &  list,
std::string  value,
bool  ignore_case = true 
)

Include if a string is included in string list.

if the second argument is included in the comma separated string list of the first argument, This operation returns "true value".

Parameters:
list The target comma separated string
value The searched string
Returns:
true: included, false: not included

bool coil::isAbsolutePath ( const std::string &  str  ) 

Investigate whether the given string is absolute path or not.

Investigate whether the given string is absolute path or not. Investigate it as an absolute path, if the string is as follows:

  • The first character '/' (UNIX)
  • The first 3 characters are alphabet +'/'+'\' (Windows)
  • The first 2 characters are '\\' (Windows network path)

Parameters:
str The target string for the investigation
Returns:
Investigation result of absolute path

bool coil::isEscaped ( const std::string &  str,
std::string::size_type  pos 
)

Check whether the character is escaped or not.

Check whether the specified character is escaped or not

Parameters:
str The string that includes the character to be investigated.
pos The position of the character to be investigated.
Returns:
True if the specified character is escaped, else False.

bool coil::isURL ( const std::string &  str  ) 

Investigate whether the given string is URL or not.

Investigate whether the given string is URL or not. When the string '://' is included in the given character string, make it of URL representation.

Parameters:
str The target string for investigation
Returns:
URL investigation result

int coil::launch_shell ( std::string  command  ) 

Launching a process.

This function launches a process. The argument is command file name be launched. The command will be searched according to the environment variable PATH of command search path. 0 will be returned if launching process is successful, and -1 will be returned if it is failed.

Parameters:
command full path string to a command to be executed.
Returns:
0: successful, -1: failed

std::string coil::normalize ( std::string &  str  ) 

Erase the head/tail blank and replace upper case to lower case.

Erase the head blank characters and the blank characters that exist at the tail of the given string. Space ' 'and tab '\t' are supported as the blank character. And all upper case cahracters are converted into lower case.

Parameters:
str The target string for the erase

Referenced by RTC::ConnectorDataListenerT< DataType >::operator()().

template<class T, class U>
bool coil::operator!= ( shared_ptr< T > const &  a,
shared_ptr< U > const &  b 
) [inline]

template<class T, class U>
bool coil::operator< ( shared_ptr< T > const &  a,
shared_ptr< U > const &  b 
) [inline]

template<class E, class T, class Y>
basic_ostream<E, T>& coil::operator<< ( basic_ostream< E, T > &  os,
shared_ptr< Y > const &  p 
) [inline]

template<class T, class U>
bool coil::operator== ( shared_ptr< T > const &  a,
shared_ptr< U > const &  b 
) [inline]

template<class Printable>
std::string coil::otos ( Printable  n  )  [inline]

Convert the given object to std::string.

Convert the object specified by the argument to string.

Parameters:
n The target object for conversion
Returns:
String conversion result

void coil::replaceString ( std::string &  str,
const std::string  from,
const std::string  to 
)

Replace string.

Replace the given string with the specified characters.

Parameters:
str The target characters of string for replacement processing
from Characters of replacement source
to Characters of replacement destination

int coil::settimeofday ( const struct timeval *  tv,
const struct timezone *  tz 
) [inline]

int coil::sleep ( TimeValue  interval  )  [inline]

References coil::TimeValue::sec(), and coil::TimeValue::usec().

Referenced by sleep().

unsigned int coil::sleep ( unsigned int  seconds  )  [inline]

References sleep().

vstring coil::split ( const std::string &  input,
const std::string &  delimiter,
bool  ignore_empty = false 
)

Split string by delimiter.

Split the set string by the given delimiter

Parameters:
input The target characters of string for split
delimiter Split string (delimiter)
Returns:
Split string result list

Referenced by RTC::ConnectorDataListenerT< DataType >::operator()().

std::string coil::sprintf ( char const *__restrict  fmt,
  ... 
)

template<class T, class U>
shared_ptr<T> coil::static_pointer_cast ( shared_ptr< U > const &  r  )  [inline]

std::wstring coil::string2wstring ( std::string  str  ) 

string to wstring conversion

This function convert from a string to a wstring.

Parameters:
str The input std::string type string
Returns:
Converted std::wstring type string

template<typename To>
bool coil::stringTo ( To &  val,
const char *  str 
) [inline]

Convert the given std::string to object.

Convert string given by the argument to specified object.

Parameters:
val The object of conversion destination
str String of conversion source
Returns:
Conversion processing result

template<>
bool coil::stringTo< std::string > ( std::string &  val,
const char *  str 
) [inline]

template<class T>
void coil::swap ( shared_ptr< T > &  a,
shared_ptr< T > &  b 
) [inline]

char** coil::toArgv ( const vstring &  args  ) 

Convert the given string list into the argument list.

Convert the string list into the argument list by adding '\0' to each element at the end of the string list given by the argument

Parameters:
args The target string list for conversion
Returns:
String of argument conversion result

bool coil::toBool ( std::string  str,
std::string  yes,
std::string  no,
bool  default_value = true 
)

Convert given string into bool value.

Compare the specified string with the true representation string and the false representation string, and return the result as bool value. If it matches neither the true representation string nor the false representation string as a result of the comparison, the given default value will be return.

Parameters:
str The target string for investigation
yes The true representation string
no The false representation string
default_value The default value (The default value:true)

void coil::toLower ( std::string &  str  ) 

Lowercase String Transformation.

This function transforms a given string to lowercase letters

Parameters:
str The input string

void coil::toUpper ( std::string &  str  ) 

Uppercase String Transformation.

This function transforms a given string to uppercase letters

Parameters:
str The input string

int coil::uname ( utsname *  name  )  [inline]

std::string coil::unescape ( const std::string  str  ) 

Unescape string.

The following characters are converted.
"\t" -> HT
"\n" -> LF
"\r" -> CR
"\f" -> FF
"\"" -> "
"\'" -> '
Note: This is not complete inversion of the escape processing.

Parameters:
str The target string for the unescape
Returns:
Result string of the unescape

vstring coil::unique_sv ( vstring  sv  ) 

Eliminate duplication from the given string list.

Create a list of eliminating duplication from the string list given by the argument.

Parameters:
sv The string list for confirmation source
Returns:
Eliminating duplication result list

int coil::usleep ( useconds_t  usec  )  [inline]

std::string coil::wstring2string ( std::wstring  wstr  ) 

wstring to string conversion

This function convert from a wstring to a string.

Parameters:
str The input std::wstring type string
Returns:
Converted std::string type string


Generated on Thu Jan 28 13:25:35 2010 for OpenRTM by  doxygen 1.5.5