Urbi SDK Remote for C++  2.7.5
urbi-root.hh
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009-2011, Gostai S.A.S.
00003  *
00004  * This software is provided "as is" without warranty of any kind,
00005  * either expressed or implied, including but not limited to the
00006  * implied warranties of fitness for a particular purpose.
00007  *
00008  * See the LICENSE file for more information.
00009  */
00010 
00011 #ifndef URBI_ROOT_HH
00012 # define URBI_ROOT_HH
00013 
00014 # include <string>
00015 # include <vector>
00016 
00017 # include <libport/detect-win32.h>
00018 # include <libport/windows.hh>
00019 
00020 # include <urbi/export.hh>
00021 
00022 # ifdef WIN32
00023 typedef HMODULE RTLD_HANDLE;
00024 # else
00025 typedef void* RTLD_HANDLE;
00026 # endif
00027 
00028 # ifndef URBI_ROOT_NOT_DLL
00029 #  define URBI_SDK_MAYBE_API URBI_SDK_API
00030 # else
00031 #  define URBI_SDK_MAYBE_API
00032 # endif
00033 
00034 class URBI_SDK_MAYBE_API UrbiRoot
00035 {
00036   /*---------------.
00037   | Construction.  |
00038   `---------------*/
00039 
00040 public:
00044   UrbiRoot(const std::string& program, bool static_build=false);
00045 
00046   /*---------------.
00047   | Entry points.  |
00048   `---------------*/
00049 
00050 public:
00051   int urbi_launch(int argc, const char** argv);
00052   int urbi_launch(int argc, char** argv);
00053   int urbi_main(const std::vector<std::string>& args, bool block, bool errors);
00054 
00055   /*--------------------------.
00056   | UObject library loaders.  |
00057   `--------------------------*/
00058 
00059 public:
00060   void load_plugin();
00061   void load_remote();
00062   void load_custom(const std::string& path);
00063 
00064   /*--------.
00065   | Paths.  |
00066   `--------*/
00067 
00068 public:
00070   const std::string& root() const;
00072   std::string core_path() const;
00075   std::string doc_dir() const;
00077   std::string share_dir() const;
00079   std::vector<std::string> uobjects_path() const;
00080 
00083   std::string library_suffix() const;
00084 
00085 private:
00088   RTLD_HANDLE
00089   library_load(const std::string& base, const std::string& env_suffix = "");
00090 
00091   std::string program_;
00092   std::string root_;
00093   RTLD_HANDLE handle_libjpeg_;
00094   RTLD_HANDLE handle_libport_;
00095   RTLD_HANDLE handle_libsched_;
00096   RTLD_HANDLE handle_libserialize_;
00097   RTLD_HANDLE handle_liburbi_;
00098   RTLD_HANDLE handle_libuobject_;
00099 };
00100 
00101 extern "C"
00102 {
00103   typedef int(*urbi_launch_type)(int argc, const char* argv[], UrbiRoot& root);
00104 
00105   int
00106   URBI_SDK_API
00107   urbi_launch(int argc, const char* argv[], UrbiRoot& root);
00108 }
00109 
00110 #endif