Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

segusoland.hpp File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define SL_NAMESPACE_BEGIN   namespace segusoland {
#define SL_NAMESPACE_END   }
#define SL_NAMESPACE_USING   using namespace segusoland;
#define SL_SHELL_PLUGINS_DIR   "SL_PLUGINS_DIR"
#define SL_PLUGIN_REGISTER(pluginInstance)   ::segusoland::registerer.registerPlugin(pluginInstance)
#define SL_FEATURE_GET(type)   (SLPluginFeature::type *)::segusoland::registerer.getFeature(SLPluginFeature::Type::type)
#define SL_FEATURE_DISPOSE(feature)   delete feature
#define SL_DEBUG1(msg)
#define SL_DEBUG2(msg)
#define SL_WARNING(msg)   std::cerr << __FILE__ << ":" << __FUNCTION__ << ":" << __LINE__ << ": ***WARNING*** " << msg << std::endl;
#define SL_PATH_SEPARATOR_CHAR   '/'
#define SL_PATH_SEPARATOR_STR   "/"
#define SL_LOCALE_DEFAULT   ""
#define SL_ENCODING_DEFAULT   ""
#define SL_REENTRANT_CLASS
#define SL_REENTRANT_CLASS_LOCK
#define SL_REENTRANT_CLASS_UNLOCK
#define SL_REENTRANT_FUN(funName)


Detailed Description

Segusoland library header.
Author:
Alexandre Sauve
This file provides shared defines for other files.

Define Documentation

#define SL_DEBUG1 msg   ) 
 

This macro is usefull to print on stderr some debug messages. SL_DEBUG1 is for low verbosity messages (not frequent ones)

SL_DEBUGn macros are affected by the compile time define SL_DEBUG_LEVEL.

  • if SL_DEBUG_LEVEL=0 : no debug message at all
  • if SL_DEBUG_LEVEL=1 : only SL_DEBUG1 messages are shown
  • if SL_DEBUG_LEVEL=2 : SL_DEBUG1 & SL_DEBUG2 messages are shown

Example :

#include "segusoland.hpp" #include <iostream> // mandatory for debug macro to work SL_DEBUG1("my message"); SL_DEBUG1("myVar = '" << myVar << "'"); // this works too

#define SL_DEBUG2 msg   ) 
 

This macro is usefull to print on stderr some debug messages. SL_DEBUG2 is for high verbosity messages (for eg : constructors)

See also:
SL_DEBUG1

#define SL_ENCODING_DEFAULT   ""
 

The default US-ASCII encoding It is the encoding used by default when contructing a SLString without providing encoding.

#define SL_FEATURE_DISPOSE feature   )     delete feature
 

This is the preffered way to dispose a feature obtained with SL_FEATURE_GET

See also:
SL_FEATURE_GET

SL_PLUGIN_REGISTER

#define SL_FEATURE_GET type   )     (SLPluginFeature::type *)::segusoland::registerer.getFeature(SLPluginFeature::Type::type)
 

This is the preffered way to obtain a feature instance from a plugin.

See also:
SL_FEATURE_DISPOSE

SL_PLUGIN_REGISTER

Example of code :
SLPluginFeature::DBAccess *db = SL_FEATURE_GET(DBAccess); // // code ... // SL_FEATURE_DISPOSE(db);

#define SL_LOCALE_DEFAULT   ""
 

The default C locale. It is the locale used when contructing a SLString without providing locale. However the syntax :

SLString s(other_slString);
Will use the locale provided by other_slString

#define SL_NAMESPACE_BEGIN   namespace segusoland {
 

Should be put before all classes declaration to make them belong to the seguloland namespace.

Example :

// This is file dummy.hpp SL_NAMESPACE_BEGIN class dummy { // code } SL_NAMESPACE_END

#define SL_NAMESPACE_END   }
 

Should be used to close the SL_NAMESPACE_BEGIN definition.

#define SL_NAMESPACE_USING   using namespace segusoland;
 

Convenience macro.

#define SL_PATH_SEPARATOR_CHAR   '/'
 

The evil path separator char.

#define SL_PATH_SEPARATOR_STR   "/"
 

The evil path separator string.

#define SL_PLUGIN_REGISTER pluginInstance   )     ::segusoland::registerer.registerPlugin(pluginInstance)
 

This has to be called once for each plugin (shared object) in its static code at dynamic loading time.

How plugins work is described in the Plugins module

#define SL_REENTRANT_CLASS
 

This declaration allow thread safe environment by allowing use of mutexes at class level. For the moment this feature is not turned on, but may be in the future.

example :

// file : MayCrashIfNotLocked.hpp class MayCrashIfNotLocked { SL_REENTRANT_CLASS public: //code }; // file MayCrashIfNotLocked.cpp MayCrashIfNotLocked::funToProtect() { SL_REENTRANT_CLASS_LOCK //code SL_REENTRANT_CLASS_UNLOCK }

#define SL_REENTRANT_CLASS_LOCK
 

Should be placed at the beginning of a function that need class level lock.

See also:
SL_REENTRANT_CLASS

#define SL_REENTRANT_CLASS_UNLOCK
 

Should be placed at the end of a function that need class level lock.

See also:
SL_REENTRANT_CLASS

#define SL_REENTRANT_FUN funName   ) 
 

This declaration allow thread safe environment by allowing use of mutexes at function level. For the moment this feature is not turned on, but may be in the future.

The class locking and function locking may be used booth

example :

// file : MayCrashIfNotLocked.hpp class MayCrashIfNotLocked { SL_REENTRANT_FUN(funName) public: void funName(); //code }; // file MayCrashIfNotLocked.cpp MayCrashIfNotLocked::funName() { SL_REENTRANT_FUN_LOCK //code here is thread safe SL_REENTRANT_FUN_UNLOCK }

#define SL_SHELL_PLUGINS_DIR   "SL_PLUGINS_DIR"
 

The shell variable name to specify plugins directory. If this variable is defined, it takes precedence over the default directory.

#define SL_WARNING msg   )     std::cerr << __FILE__ << ":" << __FUNCTION__ << ":" << __LINE__ << ": ***WARNING*** " << msg << std::endl;
 

Generate warnings on stderr. These warnings are not affected by ::SL_DEBUG_LEVEL (compile time macro)


Generated on Mon Apr 19 01:03:34 2004 for segusoLand by doxygen 1.3.6-20040222