Urbi SDK Remote for C++  2.7.5
liburbi/urbi-root.cc File Reference
#include <libport/sys/stat.h>
#include <libport/unistd.h>
#include <libport/cassert>
#include <libport/cstring>
#include <libport/cstdlib>
#include <libport/cstdio>
#include <iostream>
#include <libport/config.h>
#include <libport/foreach.hh>
#include <libport/sysexits.hh>
#include <urbi/urbi-root.hh>
#include <dlfcn.h>
Include dependency graph for liburbi/urbi-root.cc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define APPLE_LINUX_WINDOWS(Apple, Linux, Windows)   Linux
#define URBI_ROOT_ECHO(S)   std::cerr << S << std::endl \
#define URBI_ROOT_DEBUG(Self, S)
#define URBI_ROOT_FATAL(Self, N, S)


typedef std::vector< std::string > strings_type
typedef int(* urbi_main_type )(const std::vector< std::string > &args, UrbiRoot &root, bool block, bool errors)


static std::string mygetenv (const std::string &var, const std::string &val="")
static bool debug ()
static std::string urbi_getenv (const std::string &logname, std::string var, const std::string &val="")
static std::string operator/ (const std::string &lhs, const std::string &rhs)
 Join path components.
static strings_type split (std::string lib)
static RTLD_HANDLE xdlopen (const std::string &program, const std::string &msg, std::string path, sysexit status=EX_FAIL, int flags=RTLD_LAZY|RTLD_GLOBAL)
 path does not include the extension.
template<typename Res >
static Res xdlsym (const std::string &program, const char *modname, RTLD_HANDLE module, const char *name)
static std::string resolve_symlinks (const std::string &logname, const std::string &s)
static std::string find_program (const std::string &logname, std::string prog)
 Find prog in $PATH.


static const std::string libext
static const std::string separator
static const std::string libdir

Define Documentation

#define APPLE_LINUX_WINDOWS (   Apple,
)    Linux

Definition at line 34 of file liburbi/urbi-root.cc.

#define URBI_ROOT_DEBUG (   Self,
do {                                          \
    if (debug())                                \
      URBI_ROOT_ECHO(Self << ": " << S);        \
  } while (0)

Definition at line 54 of file liburbi/urbi-root.cc.

Referenced by find_program(), resolve_symlinks(), urbi_getenv(), UrbiRoot::urbi_main(), UrbiRoot::UrbiRoot(), xdlopen(), and xdlsym().

#define URBI_ROOT_ECHO (   S)    std::cerr << S << std::endl \

Definition at line 51 of file liburbi/urbi-root.cc.

#define URBI_ROOT_FATAL (   Self,
do {                                          \
    URBI_ROOT_ECHO(Self << ": " << S);          \
    exit(N);                                    \
  } while (0)

Definition at line 60 of file liburbi/urbi-root.cc.

Referenced by UrbiRoot::UrbiRoot(), xdlopen(), and xdlsym().

Typedef Documentation

typedef std::vector<std::string> strings_type

Definition at line 161 of file liburbi/urbi-root.cc.

typedef int(* urbi_main_type)(const std::vector< std::string > &args, UrbiRoot &root, bool block, bool errors)

Definition at line 504 of file liburbi/urbi-root.cc.

Function Documentation

static bool debug ( ) [static]

Definition at line 45 of file liburbi/urbi-root.cc.

References mygetenv().

Referenced by urbi_launch_().

static std::string find_program ( const std::string &  logname,
std::string  prog 
) [static]

Find prog in $PATH.

lognamethe prefix for log messages
progthe program to look for (.exe will be appended on Windows)
The full path to the parent of the directory that contains prog, or "" if not found.

Definition at line 276 of file liburbi/urbi-root.cc.

References mygetenv(), split(), and URBI_ROOT_DEBUG.

Referenced by UrbiRoot::UrbiRoot().

static std::string mygetenv ( const std::string &  var,
const std::string &  val = "" 
) [static]

Definition at line 73 of file liburbi/urbi-root.cc.

Referenced by debug(), and find_program().

static std::string operator/ ( const std::string &  lhs,
const std::string &  rhs 
) [static]

Join path components.

Definition at line 109 of file liburbi/urbi-root.cc.

References separator.

static std::string resolve_symlinks ( const std::string &  logname,
const std::string &  s 
) [static]

Definition at line 255 of file liburbi/urbi-root.cc.


Referenced by UrbiRoot::UrbiRoot().

static strings_type split ( std::string  lib) [static]

Definition at line 163 of file liburbi/urbi-root.cc.

Referenced by find_program().

static std::string urbi_getenv ( const std::string &  logname,
std::string  var,
const std::string &  val = "" 
) [static]
static RTLD_HANDLE xdlopen ( const std::string &  program,
const std::string &  msg,
std::string  path,
sysexit  status = EX_FAIL,
int  flags = RTLD_LAZY | RTLD_GLOBAL 
) [static]

path does not include the extension.

Definition at line 221 of file liburbi/urbi-root.cc.

References libext, URBI_ROOT_DEBUG, and URBI_ROOT_FATAL.

Referenced by UrbiRoot::library_load(), UrbiRoot::load_custom(), UrbiRoot::load_plugin(), and UrbiRoot::load_remote().

template<typename Res >
static Res xdlsym ( const std::string &  program,
const char *  modname,
RTLD_HANDLE  module,
const char *  name 
) [static]

Definition at line 239 of file liburbi/urbi-root.cc.


Variable Documentation

const std::string libdir [static]
Initial value:
                           APPLE_LINUX_WINDOWS("lib", "lib", "bin")

Definition at line 103 of file liburbi/urbi-root.cc.

Referenced by UrbiRoot::library_load().

const std::string libext [static]
Initial value:
                           APPLE_LINUX_WINDOWS(".dylib", ".so", ".dll")

Definition at line 99 of file liburbi/urbi-root.cc.

Referenced by xdlopen().

const std::string separator [static]
Initial value:
                           APPLE_LINUX_WINDOWS("/", "/", "\\")

Definition at line 101 of file liburbi/urbi-root.cc.

Referenced by operator/().