bbtk::Package Class Reference

registers black boxes descriptors and is able to create instances of the black boxes registered. More...

#include <bbtkPackage.h>

Inheritance diagram for bbtk::Package:

Inheritance graph
[legend]
Collaboration diagram for bbtk::Package:

Collaboration graph
[legend]

List of all members.

Public Types

typedef Package Self
typedef boost::shared_ptr< SelfPointer
typedef boost::weak_ptr< SelfWeakPointer
typedef Package::Pointer(* DLGetPackageFunction )()
typedef void(* DLDeletePackageFunction )()
typedef const std::string &(* DLGetPackageBBTKVersionFunction )()
typedef std::map< std::string,
BlackBoxDescriptor::Pointer > 
BlackBoxMapType
 The type of map of descriptors.
typedef std::map< AdaptorKey,
BlackBoxDescriptor::WeakPointer > 
AdaptorMapType
 The type of map of adaptor descriptors.
typedef std::set
< FactoryWeakPointer
FactorySet

Public Member Functions

std::string GetObjectName () const
std::string GetObjectInfo () const
size_t GetObjectSize () const
size_t GetObjectInternalSize () const
size_t GetObjectRecursiveSize () const
const std::string & GetName () const
 Returns the name of the package.
const std::string & GetAuthor () const
 Returns the author of the package.
const std::string & GetCategory () const
 Returns the category of the package.
const std::string & GetDescription () const
 Returns the description of the package.
const std::string & GetVersion () const
 Returns the version of the package.
bool ContainsBlackBox (const std::string &boxname) const
 Returns true iff the package contains the box of name boxname.
BlackBox::Pointer NewBlackBox (const std::string &type, const std::string &name) const
 Creates an instance of a black box of type <type> with name <name>.
BlackBox::Pointer NewAdaptor (const DataInfo &typein, const DataInfo &typeout, const std::string &name) const
BlackBox::Pointer NewWidgetAdaptor (const DataInfo &typein, const DataInfo &typeout, const std::string &name) const
bool FindAdaptor (const DataInfo &typein, const DataInfo &typeout, std::string &adaptor) const
bool FindWidgetAdaptor (const DataInfo &typein, const DataInfo &typeout, std::string &adaptor) const
bool RegisterBlackBox (BlackBoxDescriptor::Pointer)
 Registers a black box descriptor in the package.
void PrintBlackBoxes (bool description=false, bool adaptors=false) const
 Displays the list of black boxes of the package.
void PrintAdaptors (bool description=false) const
 Displays the list of adaptors of the package.
void HelpBlackBox (const std::string &name, bool full=true) const
 Prints help on a black box.
void CreateHtmlPage (const std::string &filename, const std::string &caller="?", const std::string &source="?", const std::string &custom_header="", const std::string &custom_title="", int detail=1, int level=0, bool relative_link=false) const
void SetDocURL (std::string url)
const std::string & GetDocURL () const
void SetDocRelativeURL (std::string url)
const std::string & GetDocRelativeURL () const
unsigned int GetNumberOfBlackBoxes () const
void ChangeBlackBoxName (const std::string &oldname, const std::string &newname)
 Changes the name of a black box type.
const BlackBoxMapType & GetBlackBoxMap () const
BlackBoxMapType & GetBlackBoxMap ()
const AdaptorMapType & GetAdaptorMap () const
void AddFactory (FactoryPointer f)
 Adds the factory to the set of factories which use the package.
void RemoveFactory (FactoryPointer f)
 Removes the factory from the set of factories which use the package.
FactorySet & GetFactorySet ()
 Gets the set of factories which use the package.
const FactorySet & GetFactorySet () const
 Gets the set of factories which use the package (const).
void CheckBoxes () const
long GetUseCount ()

Static Public Member Functions

static Pointer New (const std::string &name, const std::string &author, const std::string &description, const std::string &version, const std::string &BBTKVersion)
 Creates a new package.
static Pointer CreateFromDynamicLibrary (const std::string &libname, const std::string &pkgname, const std::string &path)
 Creates a package from a dynamic library.
static void UnLoadDynamicLibrary (Package::WeakPointer p, bool doit=true)
 UnLoads the package dynamic library (if any).
static void UnLoadReleasedDynamicallyLoadedPackages ()
static void Release (Package::WeakPointer p)
 Release.
static void ReleaseBlackBoxDescriptor (Package::WeakPointer p, BlackBoxDescriptor::WeakPointer d)
static DynamicLibraryHandler OpenDynamicLibrary (const std::string &dynamic_library_path, const std::string &package_name, DLGetPackageFunction &, DLDeletePackageFunction &)
static void InsertInObjectList (Pointer)
static void RemoveFromObjectList (WeakPointer)
static void InsertInPackageList (Pointer)
static void ReleasePackages ()
static void PrintObjectListInfo (const std::string &name)
static void PrintObjectInfo (const Pointer &o)
static long GetObjectsCount ()

Protected Types

typedef Object Superclass

Protected Member Functions

 Package ()
 Package (const Package &)
 ~Package ()
 Dtor.
void LockThis ()
void UnLockThis ()
template<class U>
boost::shared_ptr< U > GetThisPointer () const

Static Protected Member Functions

template<class U>
static boost::shared_ptr< U > MakePointer (U *s, bool lock=false)
template<class U, class D>
static boost::shared_ptr< U > MakePointer (U *s, const D &del, bool lock=false)

Private Member Functions

 Package (const std::string &name, const std::string &author, const std::string &description, const std::string &version, const std::string &BBTKVersion)
 Default ctor is private : use the static New method.

Static Private Member Functions

static void UnLoad (Package::WeakPointer p)
 Does unload a package (no test).

Private Attributes

DynamicLibraryHandler mDynamicLibraryHandler
 The dynamic library handler of the package if it was loaded from a dl.
DLDeletePackageFunction mDLDeletePackageFunction
std::string mName
 The name of the package.
std::string mAuthor
 The author of the package.
std::string mCategory
 The categories of the package.
std::string mDescription
 The description of the package.
std::string mVersion
 The version of the package.
std::string mDocURL
 URL of the documentation of the Package (absolute path).
std::string mDocRelativeURL
BlackBoxMapType mBlackBoxMap
 The map of black boxes descriptors.
AdaptorMapType mAdaptorMap
 The map of adaptors descriptors.
FactorySet mFactorySet
 The set of factories which contain the package.

Static Private Attributes

static std::set
< Package::WeakPointer > 
mReleasedDynamicallyLoadedPackages

Friends

struct Object::Deleter

Classes

class  AdaptorKey
 The type of key in the map of adaptor descriptors. More...


Detailed Description

registers black boxes descriptors and is able to create instances of the black boxes registered.

Definition at line 52 of file bbtkPackage.h.


Member Typedef Documentation

typedef Package bbtk::Package::Self

Definition at line 54 of file bbtkPackage.h.

typedef boost::shared_ptr<Self> bbtk::Package::Pointer

Reimplemented from bbtk::Object.

Definition at line 54 of file bbtkPackage.h.

typedef boost::weak_ptr<Self> bbtk::Package::WeakPointer

Reimplemented from bbtk::Object.

Definition at line 54 of file bbtkPackage.h.

typedef Object bbtk::Package::Superclass [protected]

Definition at line 54 of file bbtkPackage.h.

typedef Package::Pointer(* bbtk::Package::DLGetPackageFunction)()

typedef void(* bbtk::Package::DLDeletePackageFunction)()

typedef const std::string&(* bbtk::Package::DLGetPackageBBTKVersionFunction)()

typedef std::map< std::string, BlackBoxDescriptor::Pointer> bbtk::Package::BlackBoxMapType

The type of map of descriptors.

Definition at line 181 of file bbtkPackage.h.

typedef std::map< AdaptorKey, BlackBoxDescriptor::WeakPointer> bbtk::Package::AdaptorMapType

The type of map of adaptor descriptors.

Definition at line 214 of file bbtkPackage.h.

typedef std::set<FactoryWeakPointer> bbtk::Package::FactorySet

Definition at line 227 of file bbtkPackage.h.


Constructor & Destructor Documentation

bbtk::Package::Package (  )  [protected]

bbtk::Package::Package ( const Package  )  [protected]

bbtk::Package::~Package (  )  [protected]

Dtor.

Definition at line 115 of file bbtkPackage.cxx.

References bbtkDebugMessage, bbtkendl, and mName.

00116   {
00117     bbtkDebugMessage("object",2,"==> Package::~Package(\""<<mName<<"\")"<<bbtkendl);
00118     bbtkDebugMessage("object",2,"<== Package::~Package(\""<<mName<<"\")"<<bbtkendl);
00119   }

bbtk::Package::Package ( const std::string &  name,
const std::string &  author,
const std::string &  description,
const std::string &  version,
const std::string &  BBTKVersion 
) [private]

Default ctor is private : use the static New method.

Ctor with the name of the package.

A Package cannot be copy constructed Ctor is private : use the static New method

Definition at line 71 of file bbtkPackage.cxx.

References bbtkDebugMessage, bbtkendl, SetDocRelativeURL(), and SetDocURL().

00076     :
00077     mDynamicLibraryHandler(0),
00078     mName(name),
00079     mAuthor(author),
00080     mDescription(description),
00081     mVersion(version)
00082   {
00083     bbtkDebugMessage("object",2,"==> Package::Package('"<<name<<"',...)"
00084                      <<bbtkendl);
00085     std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
00086     char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
00087     std::string url = default_doc_dir; 
00088     if (c != '/' && c !='\\') url = url + "/";
00089     url = url +  "temp_dir/" + name + "/index.html";    
00090     
00091     SetDocURL(url);
00092     SetDocRelativeURL("Relative url not set");
00093 
00094     /*
00095     std::string relurl(BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH));
00096     relurl += "/packages/"+name+"/bbdoc/index.html";
00097     std::string url = ConfigurationFile::GetInstance().Get_url()
00098       + relurl; 
00099     SetDocURL(url);
00100     SetDocRelativeURL(relurl);   
00101     */
00102 
00103     //    std::cout  << "   url=["<<url<<"]"<<std::endl;
00104     //    std::cout  << "relurl=["<<relurl<<"]"<<std::endl;
00105     bbtkDebugMessage("object",2,"<== Package::Package('"<<name<<"',...) OK"
00106                      <<bbtkendl);
00107 
00108   }
  //==========================================================================

Here is the call graph for this function:


Member Function Documentation

std::string bbtk::Package::GetObjectName (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 1328 of file bbtkPackage.cxx.

References mName.

01329   { 
01330     return std::string("Package '")+mName+std::string("'"); 
01331   }

std::string bbtk::Package::GetObjectInfo (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 1335 of file bbtkPackage.cxx.

References bbtk::i, mBlackBoxMap, and mDynamicLibraryHandler.

01336   {
01337     std::stringstream i;
01338     i << "  - "<<mBlackBoxMap.size() << " boxes" << std::endl;
01339     if (mDynamicLibraryHandler) 
01340       {
01341         i<< "  - Loaded from dynamic library"<<std::endl;
01342       }
01343     return i.str();
01344   }

size_t bbtk::Package::GetObjectSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 1349 of file bbtkPackage.cxx.

01350   {
01351     size_t s = Superclass::GetObjectSize();
01352     s += Package::GetObjectInternalSize();
01353     return s;
01354   }

size_t bbtk::Package::GetObjectInternalSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 1357 of file bbtkPackage.cxx.

01358   {
01359     size_t s = sizeof(Package);
01360     return s;
01361   }

size_t bbtk::Package::GetObjectRecursiveSize (  )  const [virtual]

Reimplemented from bbtk::Object.

Definition at line 1364 of file bbtkPackage.cxx.

References bbtk::i, and mBlackBoxMap.

01365   {
01366     size_t s = Superclass::GetObjectRecursiveSize();
01367     s += Package::GetObjectInternalSize();
01368     
01369     BlackBoxMapType::const_iterator i;
01370     for (i = mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i )
01371       {
01372         s += i->second->GetObjectRecursiveSize();
01373       }
01374     return s;
01375   }

Package::Pointer bbtk::Package::New ( const std::string &  name,
const std::string &  author,
const std::string &  description,
const std::string &  version,
const std::string &  BBTKVersion 
) [static]

Creates a new package.

Definition at line 50 of file bbtkPackage.cxx.

References bbtkDebugMessage, bbtkendl, and bbtk::Object::MakePointer().

00055   {
00056     bbtkDebugMessage("object",1,"##> Package::New('"<<name<<"',...)"
00057                      <<bbtkendl);
00058     Package::Pointer p = MakePointer(new Package(name,
00059                                                author,
00060                                                description,
00061                                                version,
00062                                                BBTKVersion));
00063     bbtkDebugMessage("object",2,"<## Package::New('"<<name<<"',...)"
00064                      <<bbtkendl);
00065     return p;
00066   }

Here is the call graph for this function:

Package::Pointer bbtk::Package::CreateFromDynamicLibrary ( const std::string &  libname,
const std::string &  pkgname,
const std::string &  path 
) [static]

Creates a package from a dynamic library.

Loads a package from a dynamic library.

Definition at line 525 of file bbtkPackage.cxx.

References BBTK_STRINGIFY_SYMBOL, and bbtkDebugMessage.

00528   {
00529     bbtkDebugMessage("package",1,"==> Package::CreateFromDynamicLibrary("
00530                      <<libname<<")"<<std::endl);
00531 
00532     DLGetPackageFunction gf;
00533     DLDeletePackageFunction df;
00534     DynamicLibraryHandler h = Package::OpenDynamicLibrary(libname,
00535                                                           pkgname,
00536                                                           gf,df);
00537     if (h==0) return Package::Pointer(); 
00538     Package::Pointer p = gf();
00539     p->mDynamicLibraryHandler = h;
00540     p->mDLDeletePackageFunction = df;
00541     
00542     std::string separator =
00543       ConfigurationFile::GetInstance().Get_file_separator ();
00544     //BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH)
00545     std::string docreldoc = 
00546       separator + "bbdoc" + separator + pkgname + separator + "index.html";
00547     std::string reldoc = 
00548       ".." + separator + ".." + docreldoc;
00549     std::string doc = path + separator + ".." + separator
00550       + BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH)
00551       + docreldoc;
00552     
00553     p->SetDocURL(doc);
00554     p->SetDocRelativeURL(reldoc);
00555     
00556     bbtkDebugMessage("package",2,"<== Package::CreateFromDynamicLibrary("
00557                      <<libname<<") .. OK"<<std::endl);
00558     return p;
00559   }

void bbtk::Package::UnLoadDynamicLibrary ( Package::WeakPointer  p,
bool  doit = true 
) [static]

UnLoads the package dynamic library (if any).

UnLoads the package dynamic library (if any and if the package is released) If doit == false then does not do it but just put the package in the list of ReleasedDynamicallyLoadedPackages. This is because we cannot close the dl from inside a package member method or the program crashes. The actual dl close must be done by an external user calling UnLoadReleasedDynamicallyLoadedPackages

Definition at line 567 of file bbtkPackage.cxx.

References BBTK_INTERNAL_ERROR_MESSAGE, bbtkDebugMessage, bbtkGlobalError, mReleasedDynamicallyLoadedPackages, and UnLoad().

Referenced by Release(), and ReleaseBlackBoxDescriptor().

00568   {
00569     if (pack.expired() || (!pack.lock()->mDynamicLibraryHandler))
00570       return;
00571     
00572     
00573     std::string packname = pack.lock()->GetName();
00574     bbtkDebugMessage("package",5,"==> Package::UnLoadDynamicLibrary('"
00575                      <<packname<<"')"
00576                      <<std::endl);
00577     
00578     if (!pack.lock()->GetBlackBoxMap().empty())
00579       {
00580         
00581         bbtkDebugMessage("package",5,"   Package not empty ... abort"
00582                          <<std::endl);
00583         return;
00584         /*
00585         bbtkGlobalError("Package::UnLoadDynamicLibrary('"<<packname<<") : "
00586                         <<"BlackBoxMap not empty "
00587                         <<BBTK_INTERNAL_ERROR_MESSAGE);
00588         */
00589         
00590       }
00591 
00592     if (pack.use_count()!=1)
00593       {
00594         bbtkGlobalError("Package::UnLoadDynamicLibrary('"<<packname<<") : "
00595                         <<"empty dl package with external refs"
00596                         <<BBTK_INTERNAL_ERROR_MESSAGE);
00597       } 
00598 
00599     if (doit) 
00600       {
00601         UnLoad(pack);
00602         bbtkDebugMessage("package",5,"==> dynamic library for package '"
00603                          <<packname<<"' closed"
00604                          <<std::endl);    
00605       }
00606     else 
00607       {
00608         mReleasedDynamicallyLoadedPackages.insert(pack);
00609         bbtkDebugMessage("package",1,"==> package '"<<packname
00610                          <<"' put in the 'to unload' list"
00611                          <<std::endl);
00612 
00613       }
00614 
00615     bbtkDebugMessage("package",5,"<== Package::UnLoadDynamicLibrary('"
00616                      <<packname<<"')"
00617                      <<std::endl);
00618     
00619   }

Here is the call graph for this function:

Here is the caller graph for this function:

void bbtk::Package::UnLoadReleasedDynamicallyLoadedPackages (  )  [static]

UnLoads released packages that were loaded dynamically see UnLoadDynamicLibrary and ReleaseBlackBoxDescriptor

UnLoads released packages that were loaded dynamically see UnLoadDynamicLibrary and ReleaseBlackBoxDescriptor

Definition at line 625 of file bbtkPackage.cxx.

References bbtkDebugMessage, bbtk::i, mReleasedDynamicallyLoadedPackages, and UnLoad().

00626   {
00627     bbtkDebugMessage("package",5,"==> Package::UnLoadReleasedDynamicallyLoadedPackages()"<<std::endl);
00628 
00629     std::set<Package::WeakPointer>::iterator i;
00630     for (i=mReleasedDynamicallyLoadedPackages.begin();
00631          i!=mReleasedDynamicallyLoadedPackages.end();
00632          ++i)
00633       {
00634         if (!i->expired()) UnLoad(*i);
00635       }
00636     bbtkDebugMessage("package",5,"<== Package::UnLoadReleasedDynamicallyLoadedPackages()"<<std::endl);
00637   }

Here is the call graph for this function:

void bbtk::Package::Release ( Package::WeakPointer  p  )  [static]

Release.

"Releases" the package Signals the package that it can free its descriptors if they are no more used and frees and unloads the package if it is no more used (released) Note : Any non-weak pointer on the package must have been freed

Definition at line 175 of file bbtkPackage.cxx.

References bbtkDebugMessage, bbtkendl, bbtk::i, bbtk::PackageReleaseBlackBoxDescriptorInternal(), and UnLoadDynamicLibrary().

00176   {
00177     std::string packname = pack.lock()->mName;
00178     bbtkDebugMessage("package",1,"==> Package::Release('"<<
00179                      packname<<"')"<<bbtkendl);
00180 
00181     long dyn = pack.lock()->mDynamicLibraryHandler ? 1:0; 
00182     long ndesc = pack.lock()->GetBlackBoxMap().size();
00183     long nrefs = pack.use_count();
00184 
00185     bbtkDebugMessage("package",5," "<<nrefs<<" refs / "
00186                      <<ndesc<<" descr / dyn="
00187                      <<dyn<<std::endl);
00188 
00189     // A package is "free" from any external reference iff :
00190     // i) It is not dynamically loaded and nrefs == ndesc 
00191     // (each desc references its package) or
00192     // ii) It is dynamically loaded and nrefs == ndesc + 1
00193     // (A dynamic library holds a static pointer on the package it contains
00194     //  which is allocated when the PACKAGENAMEGetPackage() func is called,
00195     //  and descallocated (reset) by PACKAGENAMEDeletePackage())
00196     if (nrefs == ndesc + dyn) 
00197       {
00198         bbtkDebugMessage("package",5,
00199                          " -> No more external ref : checking descriptors"
00200                          <<bbtkendl);
00201         // We must take care that removing refs on descriptors 
00202         // can lead to their deletion which can in turn unref 
00203         // internal boxes which can release their descriptors hence 
00204         // call Package::ReleaseBlackBoxDescriptor 
00205         // As a consequence during descriptors release :
00206         // 1) The map can change dynamically : we cannot iterate over it 
00207         //    as any iterator can become invalid
00208         // 2) The package can auto-destruct : we must test its existence 
00209         //    after each release
00210         // We must also take care of not locking the package pointer 
00211         // or any ref count check in Package::ReleaseBlackBoxDescriptor
00212         // would be wrong
00213 
00214         // The list of descriptors names at start
00215         std::vector<std::string> descnamelist;
00216         BlackBoxMapType::iterator i;
00217         for (i=pack.lock()->mBlackBoxMap.begin();
00218              i!= pack.lock()->mBlackBoxMap.end();
00219              ++i)
00220           descnamelist.push_back(i->first);
00221 
00222         // Iterator over the initial names
00223         std::vector<std::string>::iterator descname;
00224         for (descname=descnamelist.begin();
00225              descname!=descnamelist.end();
00226              ++descname)
00227           {
00228             // Is package still alive ?
00229             if (pack.expired()) 
00230               {
00231                 bbtkDebugMessage("package",1,"--- Package::Release('"<<
00232                                  packname
00233                                  <<"') : package expired during release : bailing out"<<bbtkendl);
00234                 break;
00235               }
00236             
00237             PackageReleaseBlackBoxDescriptorInternal(pack,*descname);
00238             
00239           }
00240 
00241         //
00242         UnLoadDynamicLibrary(pack);
00243         // Unload orphan dl packages 
00244         Package::UnLoadReleasedDynamicallyLoadedPackages();
00245         
00246 
00247         
00248         
00249       }
00250     
00251 #ifdef BBTK_COMPILE_DEBUG_MESSAGES
00252 
00253     bbtkDebugMessage("package",2,"<== Package::Release('"<<
00254                      packname<<"')"<<bbtkendl);
00255 
00256     if (!pack.expired())
00257       {
00258         long dyn = pack.lock()->mDynamicLibraryHandler ? 1:0; 
00259         long ndesc = pack.lock()->GetBlackBoxMap().size();
00260         long nrefs = pack.use_count();
00261         
00262         bbtkDebugMessage("package",1," ... Package still alive ("
00263                          <<nrefs<<" refs / "
00264                          <<ndesc<<" descr / dyn="
00265                          <<dyn<<")"<<std::endl);
00266       }
00267     else 
00268       {
00269         bbtkDebugMessage("package",1," ... Package has been released"
00270                          <<std::endl);
00271       }
00272 #endif
00273   }

Here is the call graph for this function:

void bbtk::Package::ReleaseBlackBoxDescriptor ( Package::WeakPointer  pack,
BlackBoxDescriptor::WeakPointer  descr 
) [static]

"Releases" a black box descriptor Signals the package that it can free the given descriptor if it is no more used and frees and put it the the ReleasedDynamicallyLoadedPackages if it is dyn loaded and no more used (released) Note : Any non-weak pointer on the package must have been freed

"Releases" the package Signals the package that it can free the given descriptor if they are no more used and free itself if it is no more used Note : Any non-weak pointer on the package must have been freed

Definition at line 282 of file bbtkPackage.cxx.

References bbtkDebugMessage, bbtkendl, bbtk::PackageReleaseBlackBoxDescriptorInternal(), and UnLoadDynamicLibrary().

00284   {
00285     std::string packname = pack.lock()->mName;
00286     std::string dname = descr.lock()->GetTypeName();    
00287     bbtkDebugMessage("package",3,"==> Package::ReleaseBlackBoxDescriptor('"<<
00288                      packname<<"','"<<dname<<"') : refs="
00289                      <<descr.use_count()<<bbtkendl);
00290 
00291     long dyn = pack.lock()->mDynamicLibraryHandler ? 1:0; 
00292     long ndesc = pack.lock()->GetBlackBoxMap().size();
00293     long nrefs = pack.use_count();
00294 
00295     bbtkDebugMessage("package",5," "<<nrefs<<" refs / "
00296                      <<ndesc<<" descr / dynamically loaded = "
00297                      <<dyn<<std::endl);
00298 
00299     // A package is "free" from any external reference iff :
00300     // i) It is not dynamically loaded and nrefs == ndesc 
00301     // (each desc references its package) or
00302     // ii) It is dynamically loaded and nrefs == ndesc + 1
00303     // (A dynamic library holds a static pointer on the package it contains
00304     //  which is allocated when the PACKAGENAMEGetPackage() func is called,
00305     //  and descallocated (reset) by PACKAGENAMEDeletePackage())
00306     if (nrefs == ndesc + dyn) 
00307       {
00308         PackageReleaseBlackBoxDescriptorInternal(pack,dname);
00309       }
00310     
00311     // If the package is released and dynamically loaded 
00312     // then put it in the static list mReleasedDynamicallyLoadedPackages
00313     UnLoadDynamicLibrary(pack,false);
00314         
00315     bbtkDebugMessage("package",4,"<== Package::ReleaseBlackBoxDescriptor('"<<
00316                      packname<<"','"<<dname<<"'): refs="
00317                      <<descr.use_count()<<bbtkendl);
00318     /*
00319     if (!pack.expired())
00320       {
00321         long dyn = pack.lock()->mDynamicLibraryHandler ? 1:0; 
00322         long ndesc = pack.lock()->GetBlackBoxMap().size();
00323         long nrefs = pack.use_count();
00324         
00325         bbtkDebugMessage("package",3," ... Package still alive ("
00326                          <<nrefs<<" refs / "
00327                          <<ndesc<<" descr / dyn="
00328                          <<dyn<<")"<<std::endl);
00329       }
00330     else 
00331       {
00332         bbtkDebugMessage("package",3,"   ... Package has been released"
00333                          <<std::endl);
00334       }  
00335     */
00336   }

Here is the call graph for this function:

DynamicLibraryHandler bbtk::Package::OpenDynamicLibrary ( const std::string &  libname,
const std::string &  package_name,
DLGetPackageFunction &  getpack,
DLDeletePackageFunction &  delpack 
) [static]

Opens a dynamic library which contains a bbtk package Returns the handler Load the package management symbols from the lib returns false if a problem occured hence can be used to test that a dyn lib is a valid bbtk package lib NB : The BBTK version exported from the library is tested against the current bbtk version

Opens a dynamic library which contains a bbtk package Returns the handler Load the package management symbols from the lib returns false if a problem occured hence can be used to test that a dyn lib is a valid bbtk package lib NB : The BBTK version exported from the library is tested against the current bbtk version

Definition at line 348 of file bbtkPackage.cxx.

References BBTK_DEL_PACKAGE_FUNCTION_NAME, BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME, BBTK_GET_PACKAGE_FUNCTION_NAME, BBTK_STRINGIFY_SYMBOL, bbtkDebugMessage, bbtkError, bbtkMessage, and bbtk::GetVersion().

00352   {
00353     bbtkDebugMessage("package",3,"==> Package::OpenDynamicLibrary("
00354                      <<libname<<")"<<std::endl);
00355 #if defined(__GNUC__)
00356 
00357     // Open shared lib
00358     void *handler;
00359     handler = dlopen(libname.c_str(),
00360                      BBTK_RTLD_TIME | BBTK_RTLD_SCOPE );
00361     if (!handler)
00362       {
00363         bbtkMessage("package",2,
00364                     "Could not open shared library [" <<libname<<"] : "
00365                     <<dlerror() << std::endl);
00366         return 0;
00367       }
00368 
00369     bbtkDebugMessage("package",3,"* Shared lib ["<<libname<<"] open"<<std::endl);
00370 
00371     // Loads the Package bbtk version function 
00372     std::string getvername(package_name);
00373     getvername += 
00374       BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME);
00375     DLGetPackageBBTKVersionFunction getbbtkversion 
00376       = (DLGetPackageBBTKVersionFunction)(dlsym(handler,getvername.c_str()));
00377     if (!getbbtkversion)
00378       {
00379         bbtkDebugMessage("package",3,"***"<<std::endl);
00380         bbtkMessage("package",2,
00381                     "Shared library ["<<libname
00382                     <<"] is not a valid bbtk package."
00383                     <<" Symbol ["<<getvername<<"] :"<<dlerror()<< std::endl);
00384         dlclose(handler);
00385         return 0;
00386       }
00387 
00388     bbtkDebugMessage("package",3,"* Symbol ["<<getvername
00389                      <<"] found"<<std::endl);
00390     // version matches ?
00391     if (getbbtkversion() != bbtk::GetVersion())
00392       {
00393         bbtkMessage("package",2,
00394                     "Shared library ["<<libname
00395                     <<"] was build with bbtk version "
00396                     <<getbbtkversion()
00397                     <<" but the current program runs with version "
00398                     <<bbtk::GetVersion()<<" : cannot load it"<<std::endl);
00399         dlclose(handler);
00400         return 0;
00401         
00402       }
00403 
00404     bbtkDebugMessage("package",3,"* Package bbtk version '"<<getbbtkversion()<<"' matches"<<std::endl);
00405             // Loads the Package get function
00406     std::string getpackname(package_name);
00407     getpackname += BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_FUNCTION_NAME);
00408     getpack = (DLGetPackageFunction)(dlsym(handler, getpackname.c_str()));
00409     if (!getpack)
00410       {
00411         bbtkMessage("package",2,
00412                     "Shared library ["<<libname
00413                     <<"] is not a valid bbtk package."
00414                     <<" Symbol ["<<getpackname<<"] :"<<dlerror()<< std::endl);
00415         dlclose(handler);
00416         return 0;
00417       }
00418   
00419     bbtkDebugMessage("package",3,"* Symbol ["<<getpackname<<"] found"<<std::endl);
00420     // Loads the Package delete function
00421                                           
00422     std::string delpackname(package_name);
00423     delpackname += BBTK_STRINGIFY_SYMBOL(BBTK_DEL_PACKAGE_FUNCTION_NAME);
00424     delpack = (DLDeletePackageFunction)(dlsym(handler, delpackname.c_str()));
00425     if (!delpack)
00426       {
00427         bbtkMessage("package",2,
00428                     "Shared library ["<<libname
00429                     <<"] is not a valid bbtk package."
00430                     <<" Symbol ["<<delpackname<<"] :"<<dlerror()<< std::endl);
00431         dlclose(handler);
00432         return 0;
00433       }
00434     bbtkDebugMessage("package",3,"* Symbol ["<<delpackname<<"] found"<<std::endl);                
00435 #elif defined(_WIN32)
00436     
00437     HINSTANCE handler;
00438     
00439     SetErrorMode(0);
00440     // Open shared lib
00441     handler = LoadLibrary(libname.c_str());
00442     if (!handler)
00443       {
00444         bbtkMessage("package",2,
00445                     "Could not open shared library [" <<libname<<"]"
00446                     << std::endl);
00447         DWORD dwErrorCode = 0;
00448         dwErrorCode = GetLastError();
00449         bbtkMessage("package",2,
00450                 "Windows Error: [" << dwErrorCode <<"]"
00451                 << std::endl);
00452          
00453         return 0;
00454       }
00455     
00456     // Loads the Package bbtk version function 
00457     std::string getvername(package_name);
00458     getvername += 
00459       BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_BBTK_VERSION_FUNCTION_NAME);
00460     DLGetPackageBBTKVersionFunction getbbtkversion 
00461       = (DLGetPackageBBTKVersionFunction)(GetProcAddress(handler,
00462                                                         getvername.c_str()));
00463     if (!getbbtkversion)
00464       {
00465         FreeLibrary(handler);
00466         bbtkMessage("package",2,
00467                     "Shared library ["<<libname
00468                     <<"] is not a valid bbtk package."
00469                     <<" Symbol ["<<getbbtkversion<<"] not found"<< std::endl);
00470         return 0;
00471       }
00472     
00473     // version matches ?
00474     if (getbbtkversion() != bbtk::GetVersion())
00475       {
00476         FreeLibrary(handler);
00477         bbtkMessage("package",2,
00478                     "Shared library ["<<libname
00479                     <<"] was build with bbtk version "
00480                     <<getbbtkversion()
00481                     <<" but the current program runs with version "
00482                     <<bbtk::GetVersion()<<" : cannot load it"<<std::endl);
00483         return 0;
00484         
00485       }
00486 
00487      // Loads the Package get function
00488     std::string getpackname(package_name);
00489     getpackname += BBTK_STRINGIFY_SYMBOL(BBTK_GET_PACKAGE_FUNCTION_NAME);
00490     getpack = (DLGetPackageFunction)(GetProcAddress(handler, getpackname.c_str()));
00491     if (!getpack)
00492       {
00493         FreeLibrary(handler);
00494         bbtkMessage("package",2,
00495                     "Shared library ["<<libname
00496                     <<"] is not a valid bbtk package."
00497                     <<" Symbol ["<<getpackname<<"] not found"<< std::endl);
00498         return 0;
00499       }
00500     
00501     // Loads the Package delete function
00502     std::string delpackname(package_name);
00503     delpackname += BBTK_STRINGIFY_SYMBOL(BBTK_DEL_PACKAGE_FUNCTION_NAME);
00504     delpack = (DLDeletePackageFunction)(GetProcAddress(handler, delpackname.c_str()));
00505     if (!delpack)
00506       {
00507         FreeLibrary(handler);
00508         bbtkMessage("package",2,
00509                     "Shared library ["<<libname
00510                     <<"] is not a valid bbtk package."
00511                     <<" Symbol ["<<delpackname<<"] not found"<< std::endl);
00512         return 0;
00513       }
00514                                          
00515 #else
00516     bbtkError("neither __GNUC__ nor _WIN32 ?!? How did you compile ?");
00517 #endif
00518     
00519     return handler;
00520   }

Here is the call graph for this function:

const std::string& bbtk::Package::GetName (  )  const [inline]

Returns the name of the package.

Definition at line 117 of file bbtkPackage.h.

Referenced by ChangeBlackBoxName(), CheckBoxes(), ContainsBlackBox(), CreateHtmlPage(), FindAdaptor(), FindWidgetAdaptor(), HelpBlackBox(), NewAdaptor(), NewBlackBox(), NewWidgetAdaptor(), and RegisterBlackBox().

00117 { return mName; }

Here is the caller graph for this function:

const std::string& bbtk::Package::GetAuthor (  )  const [inline]

Returns the author of the package.

Definition at line 120 of file bbtkPackage.h.

Referenced by CreateHtmlPage().

00120 { return mAuthor; }

Here is the caller graph for this function:

const std::string& bbtk::Package::GetCategory (  )  const [inline]

Returns the category of the package.

Definition at line 123 of file bbtkPackage.h.

Referenced by CreateHtmlPage().

00123 { return mCategory; }

Here is the caller graph for this function:

const std::string& bbtk::Package::GetDescription (  )  const [inline]

Returns the description of the package.

Definition at line 126 of file bbtkPackage.h.

Referenced by CreateHtmlPage().

00126 { return mDescription; }

Here is the caller graph for this function:

const std::string& bbtk::Package::GetVersion (  )  const [inline]

Returns the version of the package.

Definition at line 129 of file bbtkPackage.h.

00129 { return mVersion; }

bool bbtk::Package::ContainsBlackBox ( const std::string &  boxname  )  const

Returns true iff the package contains the box of name boxname.

Definition at line 1079 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, GetName(), bbtk::i, and mBlackBoxMap.

01080   {
01081     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::HelpBlackBox(\""
01082                         <<name<<"\")"<<bbtkendl);
01083     
01084     BlackBoxMapType::const_iterator i = mBlackBoxMap.find(name);
01085     if (i == mBlackBoxMap.end())  
01086     {
01087       bbtkDebugDecTab("Kernel",8);
01088       return false;
01089     }
01090     bbtkDebugDecTab("Kernel",8);
01091     return true;
01092   }

Here is the call graph for this function:

BlackBox::Pointer bbtk::Package::NewBlackBox ( const std::string &  type,
const std::string &  name 
) const

Creates an instance of a black box of type <type> with name <name>.

Definition at line 669 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, GetName(), bbtk::i, and mBlackBoxMap.

00671   {
00672     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::NewBlackBox(\""<<type<<"\",\""<<name<<"\")"<<bbtkendl);
00673     
00674     BlackBoxMapType::const_iterator i = mBlackBoxMap.find(type);
00675     if (i == mBlackBoxMap.end())  
00676     {
00677            bbtkDebugDecTab("Kernel",8);
00678            return BlackBox::Pointer();
00679     }
00680     BlackBox::Pointer bb =i->second->NewBlackBox(name);
00681     bbtkDebugDecTab("Kernel",8);
00682     return bb;   
00683 
00684   }

Here is the call graph for this function:

BlackBox::Pointer bbtk::Package::NewAdaptor ( const DataInfo typein,
const DataInfo typeout,
const std::string &  name 
) const

Creates an instance of an adaptor of input type <typein> and output type <typeout> with name <name>

Definition at line 692 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, GetName(), bbtk::i, and mAdaptorMap.

00695   {
00696     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<
00697                         ">::NewAdaptor("
00698                         <<typein<<","
00699                         <<typeout<<",\""
00700                         <<name<<"\")"<<bbtkendl);
00701 
00702     AdaptorKey key(typein,typeout,
00703                    BlackBoxDescriptor::DEFAULT_ADAPTOR);
00704     AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
00705     if (i == mAdaptorMap.end())  
00706       {
00707         bbtkDebugDecTab("Kernel",8);
00708         return BlackBox::Pointer();
00709       }
00710     BlackBox::Pointer bb =i->second.lock()->NewBlackBox(name);
00711     bbtkDebugDecTab("Kernel",8);
00712     return bb;   
00713 
00714   }

Here is the call graph for this function:

BlackBox::Pointer bbtk::Package::NewWidgetAdaptor ( const DataInfo typein,
const DataInfo typeout,
const std::string &  name 
) const

Creates an instance of an adaptor of input type <typein> and output type <typeout> with name <name>

Definition at line 720 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, GetName(), bbtk::i, and mAdaptorMap.

00723   {
00724     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<
00725                         ">::NewWidgetAdaptor("
00726                         <<typein<<","
00727                         <<typeout<<",\""
00728                         <<name<<"\")"<<bbtkendl);
00729 
00730     AdaptorKey key(typein,typeout,
00731                    BlackBoxDescriptor::DEFAULT_GUI);
00732     AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
00733     if (i == mAdaptorMap.end())  
00734       {
00735         bbtkDebugDecTab("Kernel",8);
00736         return BlackBox::Pointer();
00737       }
00738     BlackBox::Pointer bb =i->second.lock()->NewBlackBox(name);
00739     bbtkDebugDecTab("Kernel",8);
00740     return bb;   
00741 
00742   }

Here is the call graph for this function:

bool bbtk::Package::FindAdaptor ( const DataInfo typein,
const DataInfo typeout,
std::string &  adaptor 
) const

Returns true is the package contains an adaptor of input type <typein> and output type <typeout> If successfull then adaptor contains the black box type name

Definition at line 786 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, GetName(), bbtk::i, and mAdaptorMap.

00789   {
00790     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<
00791                         ">::FindAdaptor("
00792                         <<typein<<","
00793                         <<typeout<<")"<<bbtkendl);
00794     
00795     AdaptorKey key(typein,typeout,
00796                    BlackBoxDescriptor::DEFAULT_ADAPTOR);
00797     AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
00798     if (i == mAdaptorMap.end())  
00799       {
00800         bbtkDebugDecTab("Kernel",8);
00801         return false;
00802       }
00803     adaptor = i->second.lock()->GetTypeName();
00804     bbtkDebugDecTab("Kernel",8);
00805     return true;   
00806 
00807   }

Here is the call graph for this function:

bool bbtk::Package::FindWidgetAdaptor ( const DataInfo typein,
const DataInfo typeout,
std::string &  adaptor 
) const

Returns true is the package contains an adaptor of input type <typein> and output type <typeout> If successfull then adaptor contains the black box type name

Definition at line 752 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, GetName(), bbtk::i, and mAdaptorMap.

00755   {
00756     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<
00757                         ">::FindWidgetAdaptor("
00758                         <<typein<<","
00759                         <<typeout<<")"<<bbtkendl);
00760    
00761     AdaptorKey key(/*typein*/
00762                    DataInfo(typeid(void),""),
00763                    typeout,
00764                    BlackBoxDescriptor::DEFAULT_GUI);
00765     // First try to find a single widget adaptor
00766     AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
00767     if (i == mAdaptorMap.end())  
00768       {
00769         bbtkDebugDecTab("Kernel",8);
00770         return false;
00771       }
00772     adaptor = i->second.lock()->GetTypeName();
00773     bbtkDebugDecTab("Kernel",8);
00774     return true;   
00775 
00776   }

Here is the call graph for this function:

bool bbtk::Package::RegisterBlackBox ( BlackBoxDescriptor::Pointer  d  ) 

Registers a black box descriptor in the package.

Definition at line 813 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessage, bbtkDebugMessageInc, bbtkError, bbtkWarning, GetName(), bbtk::i, mAdaptorMap, and mBlackBoxMap.

00814   {
00815     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::RegisterBlackBox(\""<<d->GetTypeName()<<"\")"<<std::endl);
00816     
00817     BlackBoxMapType::iterator i = mBlackBoxMap.find(d->GetTypeName());
00818     if (i!=mBlackBoxMap.end())
00819       {
00820         bbtkWarning("Package<"<<GetName()<<"> : Trying to register box type <"
00821                     <<d->GetTypeName()<<"> which is already in the package");
00822         return false;
00823       }
00824 
00825     mBlackBoxMap[d->GetTypeName()] = d;
00826     //    d->Reference();
00827     d->SetPackage(GetThisPointer<Package>());
00828     
00829     // If it is a default adaptor, also register it in the adaptors map
00830     if ( d->GetKind() == BlackBoxDescriptor::DEFAULT_ADAPTOR )
00831       {
00832         bbtkDebugMessage("Kernel",8,"Package<"<<GetName()<<">::RegisterBlackBox(\""<<d->GetTypeName()<<"\") : The box is an adaptor, inserting it in adaptors map ..."<<std::endl);   
00833         
00834         TypeInfo typein = d->GetInputDescriptor("In")->GetTypeInfo();
00835         TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo();
00836         DataInfo infoin(typein,d->GetInputDescriptor("In")->GetNature());
00837         DataInfo infoout(typeout,d->GetOutputDescriptor("Out")->GetNature());
00838         AdaptorKey key(infoin,infoout,d->GetKind());
00839         
00840         AdaptorMapType::const_iterator i;
00841         i = mAdaptorMap.find(key);        
00842         if (i == mAdaptorMap.end())  
00843           {
00844             mAdaptorMap[key] = d;
00845           }
00846         // If already an adaptor registered : error
00847         else 
00848           {
00849             if (i->second.lock()->GetTypeName() != d->GetTypeName()) 
00850               {
00851                 bbtkError("Package <"<<GetName()<<
00852                           "> : trying to register black box <"
00853                           <<d->GetTypeName()
00854                           <<"> as default adaptor but there is already a default adaptor registered (<"
00855                           <<i->second.lock()->GetTypeName()<<">)");
00856               }
00857           }
00858       }
00859     // If it is a default adaptor, also register it in the adaptors map
00860     else if ( d->GetKind() == BlackBoxDescriptor::DEFAULT_GUI)
00861       {
00862         bbtkDebugMessage("Kernel",8,"Package<"<<GetName()<<">::RegisterBlackBox(\""<<d->GetTypeName()<<"\") : The box is a widget adaptor, inserting it in adaptors map ..."<<std::endl);   
00863         
00864         TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo();
00865         DataInfo infoin(typeid(void),"");
00866         DataInfo infoout(typeout,d->GetOutputDescriptor("Out")->GetNature());
00867         AdaptorKey key(infoin,infoout,d->GetKind());
00868 
00869         AdaptorMapType::const_iterator i;
00870         i = mAdaptorMap.find(key);        
00871         if (i == mAdaptorMap.end())  
00872           {
00873             mAdaptorMap[key] = d;
00874           }
00875         // If already an adaptor registered : error
00876         else 
00877           {
00878             if (i->second.lock()->GetTypeName() != d->GetTypeName()) 
00879               {
00880                 bbtkError("Package <"<<GetName()<<
00881                           "> : trying to register black box <"
00882                           <<d->GetTypeName()
00883                           <<"> as default widget adaptor but there is already a default adaptor registered (<"
00884                           <<i->second.lock()->GetTypeName()<<">)");
00885               }
00886           }
00887       }
00888     
00889 
00890     bbtkDebugDecTab("Kernel",8);
00891    
00892     return true;
00893   }

Here is the call graph for this function:

void bbtk::Package::PrintBlackBoxes ( bool  description = false,
bool  adaptors = false 
) const

Displays the list of black boxes of the package.

Definition at line 939 of file bbtkPackage.cxx.

References bbtkMessage, bbtk::i, and mBlackBoxMap.

00940   {
00941     unsigned int lmax = 0;
00942     std::vector<std::string> names;
00943     std::vector<std::string> kinds;
00944     std::vector<std::string> descrs;
00945 
00946     BlackBoxMapType::const_iterator i;
00947     for (i=mBlackBoxMap.begin();
00948          i!=mBlackBoxMap.end();
00949          ++i) 
00950       {
00951         if ( adaptors || 
00952              ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) ) 
00953           {
00954             std::string name("  ");
00955             name += i->second->GetTypeName();
00956             names.push_back(name);
00957 
00958             std::string kind;
00959             if ( i->second->GetKind() == BlackBoxDescriptor::ADAPTOR )
00960               {
00961                 kind = std::string("[A]");
00962               }
00963             else if ( i->second->GetKind() == 
00964                       BlackBoxDescriptor::DEFAULT_ADAPTOR )
00965               {
00966                 kind = std::string("[DA]");
00967               }
00968             kinds.push_back(kind);
00969 
00970             unsigned int l = name.size()+kind.size();
00971             if (l>lmax) lmax = l;
00972 
00973             std::string descr;
00974             if (description) 
00975               {
00976                 descr += " : ";
00977                 descr += i->second->GetDescription();
00978               } 
00979             descrs.push_back(descr);
00980           }
00981       } 
00982     
00983 
00984     std::string offs;
00985     offs.append(lmax+3,' ');
00986     std::vector<std::string>::iterator ni,ci,di;
00987     for (ni = names.begin(), ci = kinds.begin(), di = descrs.begin();
00988          ni != names.end(); ++ni, ++ci, ++di)
00989       {
00990         std::string space;
00991         space.append(lmax - ni->size() - ci->size(),' ');
00992         bbtkMessage("Help",1,*ni << space << *ci );
00993         std::string d(*di);
00994         unsigned int dmax = 75 - lmax;
00995         //      while (d.size() > dmax ) 
00996         //  {
00997         if (d.size()>dmax) 
00998           bbtkMessage("Help",1,d.substr(0,dmax) << "..." << std::endl);
00999         else 
01000           bbtkMessage("Help",1,d << std::endl);
01001         //    d = d.substr(dmax,d.size());
01002         //  }
01003       }
01004 
01005   }

void bbtk::Package::PrintAdaptors ( bool  description = false  )  const

Displays the list of adaptors of the package.

Definition at line 1010 of file bbtkPackage.cxx.

References bbtkMessage, bbtk::i, and mBlackBoxMap.

01011   {
01012     BlackBoxMapType::const_iterator i;
01013     for (i=mBlackBoxMap.begin();
01014          i!=mBlackBoxMap.end();
01015          ++i) 
01016       {
01017         if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD ) 
01018           {
01019             bbtkMessage("Help",1,
01020                         "  "<<i->second->GetTypeName());
01021             if ( i->second->GetKind() == 
01022                  BlackBoxDescriptor::DEFAULT_ADAPTOR )
01023               {
01024                 bbtkMessage("Help",1,
01025                             " [default]");
01026               }  
01027             if (description) 
01028               {
01029                 bbtkMessage("Help",1,
01030                             " : "<<i->second->GetDescription());
01031 
01032               } 
01033             bbtkMessage("Help",1,std::endl);
01034           }
01035       } 
01036     /*
01037     AdaptorMapType::const_iterator i;
01038     for (i=mAdaptorMap.begin();
01039          i!=mAdaptorMap.end();
01040          ++i) 
01041       {
01042         bbtkMessage("Help",1,
01043                     "  "<<i->second->GetTypeName());
01044         if (detail_level>0) 
01045           {
01046             bbtkMessage("Help",1,
01047                         " : "<<i->second->GetDescription());
01048   
01049           } 
01050         bbtkMessage("Help",1,std::endl);
01051       }
01052     */ 
01053   }

void bbtk::Package::HelpBlackBox ( const std::string &  name,
bool  full = true 
) const

Prints help on a black box.

Definition at line 1058 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, bbtkError, GetName(), bbtk::i, and mBlackBoxMap.

01059   {
01060     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::HelpBlackBox(\""
01061                         <<name<<"\")"<<bbtkendl);
01062 
01063     BlackBoxMapType::const_iterator i = mBlackBoxMap.find(name);
01064     if (i == mBlackBoxMap.end())  
01065       {
01066         bbtkDebugDecTab("Kernel",8);
01067         bbtkError("The package <"<<GetName()<<"> does not contains the black box <"<<name<<">");
01068       }
01069     //    bbtkMessage("Help",1,"["<<GetName()<<"] ");
01070     i->second->GetHelp(full);
01071     bbtkDebugDecTab("Kernel",8);
01072 
01073   }

Here is the call graph for this function:

void bbtk::Package::CreateHtmlPage ( const std::string &  filename,
const std::string &  caller = "?",
const std::string &  source = "?",
const std::string &  custom_header = "",
const std::string &  custom_title = "",
int  detail = 1,
int  level = 0,
bool  relative_link = false 
) const

Definition at line 1098 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, bbtkError, GetAuthor(), GetCategory(), GetDescription(), GetName(), bbtk::GetVersion(), bbtk::i, mAdaptorMap, and mBlackBoxMap.

01106   {
01107     bbtkDebugMessageInc("Kernel",9,"Package<"<<GetName()<<">::CreateHtmlPage(\""
01108                         <<filename<<"\")"<<bbtkendl);
01109 
01110     //---------------------
01111     // Open output file
01112     std::ofstream s;
01113     s.open(filename.c_str());
01114     if (!s.good()) 
01115     {
01116        bbtkError("Package "<<GetName()<<" : CreateHtmlPage : could not open file '"<<filename<<"'");
01117     }
01118     
01119     //----------------------
01120     // Html head
01121     std::string title = "BBTK Package "+GetName()+" "+GetVersion(); 
01122 
01123     if (custom_title.length() != 0) title = custom_title;
01124 
01125     s << "<html lang=\"en\">\n";
01126     s << "<head>\n";
01127     s << "<title>" << title << "</title>\n";
01128     s << "<meta http-equiv=\"Content-Type\" content=\"text/html\">\n";
01129     s << "<meta name=\"description\" content=\""<<title<<"\">\n";
01130     s << "<meta name=\"generator\" content=\"\">\n";
01131     s << "<link title=\"Top\" rel=\"top\" href=\"#Top\">\n";
01132     //<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
01133     s << "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"><style type=\"text/css\"><!--\n";
01134     s << "pre.display { font-family:inherit }\n";
01135     s << "pre.format  { font-family:inherit }\n";
01136     s << "pre.smalldisplay { font-family:inherit; font-size:smaller }\n";
01137     s << "pre.smallformat  { font-family:inherit; font-size:smaller }\n";
01138     s << "pre.smallexample { font-size:smaller }\n";
01139     s << "pre.smalllisp    { font-size:smaller }\n";
01140     s << "span.sc    { font-variant:small-caps }\n";
01141     s << "span.roman { font-family:serif; font-weight:normal; } \n";
01142     s << "span.sansserif { font-family:sans-serif; font-weight:normal; }\n"; 
01143     s << "--></style>\n";
01144     s << "</head>\n";
01145     //----------------------
01146 
01147     //----------------------
01148     // Html body
01149     s << "<body>\n";
01150     s << "<a name=\"Top\"></a>\n"; 
01151     
01152     //----------------------
01153     // Header
01154     if ( custom_header.length() != 0) 
01155       {
01156         if ( custom_header != "none" )
01157           { 
01158             std::ifstream in;
01159             in.open(custom_header.c_str());    
01160             if (!in.good()) 
01161               {
01162                 bbtkError("Could not open file \""<<custom_header<<"\"");
01163               }
01164             char buffer[512];
01165             while (!in.eof()) 
01166               {
01167                 in.getline(buffer,512);
01168                 std::string line(buffer);
01169                 s << line;
01170               }
01171             in.close();
01172             s << "<hr>\n";
01173            
01174             /*   
01175             s << "<object data=\"" << custom_header 
01176               << "\" type = \"text/html\"\"style=\"width: 1200px; height: 400px;\"> Warning: "
01177               << custom_header <<" could not be embedded.</object>\n";
01178             
01179             s << "<hr>\n";
01180             */
01181           }
01182       }
01183 
01184     else 
01185       {
01186         s << "<h1 class=\"settitle\">"<<title<<"</h1>\n";
01187         s << "<p><TABLE cellspacing=0  cellpadding=3>\n";
01188         s << "<TR><TD style='vertical-align: top;'><b> Description </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
01189           << GetDescription() << "</TD></TR>\n";
01190         s << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
01191           << GetAuthor() << "</TD></TR>\n";
01192         s << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
01193           << GetCategory() << "</TD></TR>\n";
01194         s << "<TR><TD style='vertical-align: top;'><b> Version </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
01195           << GetVersion() << "</TD></TR>\n";
01196         s << "<TR><TD style='vertical-align: top;'><b> bbtk Version </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
01197           << bbtk::GetVersion() << "</TD></TR>\n";
01198         s << "</TABLE>\n";
01199       }
01200 
01201     //-------------------
01202     // Table of contents
01203     // Black boxes list
01204     //  s << "<div class=\"contents\">\n";
01205     s << "<p><b> Black Boxes : </b>\n";
01206     s << "<ul>\n";
01207 
01208     s << "<p><TABLE cellspacing=0  cellpadding=3>\n";
01209 
01210     BlackBoxMapType::const_iterator i;
01211     for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i) 
01212       {
01213         if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD) 
01214           continue;
01215         
01216         std::string name = i->second->GetTypeName();
01217         Utilities::html_format(name);
01218         std::string descr = i->second->GetDescription();
01219         //Utilities::html_format(descr);
01220 
01221         s << "<TR>";
01222         s << "<TD style='vertical-align: top;'>";
01223         s << "&nbsp;&nbsp;&nbsp;<a name=\"toc_"<<name
01224           <<"\" href=\"#"<<name<<"\">"
01225           <<name<<"</a>";
01226         s << "</TD> ";
01227         s << " <TD style='vertical-align: top;'>" << descr << " </TD>";
01228         s << "</TR>\n";
01229       }    
01230     s << "</TABLE>\n";
01231     
01232     
01233     s << "</ul>\n";
01234     s << "</div>\n";
01235     
01236     //-------------------
01237     // Adaptors list
01238     if (mAdaptorMap.size()>0) 
01239       {
01240         //  s << "<div class=\"contents\">\n";
01241         s << "<p><b> Adaptors : </b>\n";
01242         s << "<ul>\n";
01243 
01244         //    BlackBoxMapType::const_iterator i;
01245         s << "<p><TABLE cellspacing=0  cellpadding=3>\n";
01246         for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end();++i) 
01247           {
01248             if ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) 
01249               continue;
01250     
01251             std::string name = i->second->GetTypeName();
01252             Utilities::html_format(name);
01253             std::string descr = i->second->GetDescription();
01254     
01255             s << "<TR>";
01256             s << "<TD style='vertical-align: top;'>";
01257             s << "&nbsp;&nbsp;&nbsp;<a name=\"toc_"<<name
01258               <<"\" href=\"#"<<name<<"\">"
01259               <<name<<"</a>";
01260             s << "</TD> ";
01261             s << " <TD style='vertical-align: top;'>" << descr << " </TD>";
01262             s << "</TR>\n";
01263           }    
01264         s << "</TABLE>\n";
01265 
01266         s << "</ul>\n";
01267         s << "</div>\n";
01268       }
01269     
01270     
01271     //  s << "<div class=\"node\">\n";
01272 
01273     //    s << "<p><hr>\n";
01274     //    s << "<a name=\"Top\"></a>\n";
01275     //  s << "Top:&nbsp;<a rel=\"top\" accesskey=\"t\" href=\"#Top\">Top</a>\n";
01276     // s << "Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
01277     // s << "Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
01278     
01279     //    s << "</div>\n";
01280 
01281     //----------------------
01282     // Boxes doc
01283 
01284     //-------------------
01285     // Computes output directory from filename to pass it to 
01286     // BlackBoxDescriptor::InsertHtmlHelp
01287     std::string dir;
01288 
01289     std::string::size_type slash_position = filename.find_last_of("/\\");
01290 
01291 
01292         if (slash_position != std::string::npos) {
01293       if (slash_position == 0)
01294          slash_position = 1;  
01295       dir = filename.substr(0,slash_position);
01296     }
01297 
01298     for (i=mBlackBoxMap.begin();
01299          i!=mBlackBoxMap.end();
01300          ++i) 
01301       {
01302         i->second->InsertHtmlHelp(s,detail,level,dir,relative_link);
01303       }    
01304 
01305     //----------------------
01306     // Footer 
01307     time_t rawtime;
01308     tm * ptm;
01309     time ( &rawtime );
01310     ptm = gmtime ( &rawtime );
01311 
01312     s << "<p><hr>\n";
01313     s << "Automatically generated by <b>"<<caller<<"</b> "//from <b>"
01314       //      <<source<<"</b>
01315       <<"on "
01316       << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900 
01317       << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n";
01318     s << "</body></html>\n"; 
01319     s.close();
01320     //----------------------
01321 
01322     // End
01323     bbtkDebugDecTab("Kernel",9);
01324   }

Here is the call graph for this function:

void bbtk::Package::SetDocURL ( std::string  url  )  [inline]

Definition at line 167 of file bbtkPackage.h.

Referenced by Package().

00167 { mDocURL=url; }

Here is the caller graph for this function:

const std::string& bbtk::Package::GetDocURL (  )  const [inline]

Definition at line 168 of file bbtkPackage.h.

00168 { return mDocURL; }

void bbtk::Package::SetDocRelativeURL ( std::string  url  )  [inline]

Definition at line 170 of file bbtkPackage.h.

Referenced by Package().

00170 { mDocRelativeURL=url; }

Here is the caller graph for this function:

const std::string& bbtk::Package::GetDocRelativeURL (  )  const [inline]

Definition at line 171 of file bbtkPackage.h.

00171 { return mDocRelativeURL; }

unsigned int bbtk::Package::GetNumberOfBlackBoxes (  )  const [inline]

Definition at line 174 of file bbtkPackage.h.

00174 { return mBlackBoxMap.size(); }

void bbtk::Package::ChangeBlackBoxName ( const std::string &  oldname,
const std::string &  newname 
)

Changes the name of a black box type.

Definition at line 916 of file bbtkPackage.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, GetName(), bbtk::i, and mBlackBoxMap.

00917   { 
00918     bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::ChangeBlackBoxName(\""<<oldname<<"\",\""<<newname<<"\")"<<std::endl);
00919     // Looking into the bb map
00920     BlackBoxMapType::iterator i = mBlackBoxMap.find(oldname);
00921     if (i == mBlackBoxMap.end())  
00922       {
00923          bbtkDebugDecTab("Kernel",8);
00924          bbtkError("ChangeBlackBoxName : The package <"<<GetName()<<"> does not contains the black box <"<<oldname<<">");
00925       }
00926 
00927     i->second->SetTypeName(newname);
00928     mBlackBoxMap[newname] = i->second;
00929     mBlackBoxMap.erase(i);
00930 
00931     bbtkDebugDecTab("Kernel",8);    
00932   }

Here is the call graph for this function:

const BlackBoxMapType& bbtk::Package::GetBlackBoxMap (  )  const [inline]

Definition at line 182 of file bbtkPackage.h.

00182 { return mBlackBoxMap; }

BlackBoxMapType& bbtk::Package::GetBlackBoxMap (  )  [inline]

Definition at line 183 of file bbtkPackage.h.

00183 { return mBlackBoxMap; }

const AdaptorMapType& bbtk::Package::GetAdaptorMap (  )  const [inline]

Definition at line 217 of file bbtkPackage.h.

00217 { return mAdaptorMap; }

void bbtk::Package::AddFactory ( FactoryPointer  f  )  [inline]

Adds the factory to the set of factories which use the package.

Definition at line 222 of file bbtkPackage.h.

00222 { mFactorySet.insert(f); }

void bbtk::Package::RemoveFactory ( FactoryPointer  f  )  [inline]

Removes the factory from the set of factories which use the package.

Definition at line 224 of file bbtkPackage.h.

00224 { mFactorySet.erase(f); }

FactorySet& bbtk::Package::GetFactorySet (  )  [inline]

Gets the set of factories which use the package.

Definition at line 229 of file bbtkPackage.h.

00229 { return mFactorySet; }

const FactorySet& bbtk::Package::GetFactorySet (  )  const [inline]

Gets the set of factories which use the package (const).

Definition at line 231 of file bbtkPackage.h.

00231 { return mFactorySet; }

void bbtk::Package::CheckBoxes (  )  const

Definition at line 897 of file bbtkPackage.cxx.

References bbtkMessage, GetName(), bbtk::i, and mBlackBoxMap.

00898   {
00899     bbtkMessage("debug",1,"****** Checking Package "<<(void*)this
00900                 <<" ["<<GetName()<<"]"<<std::endl);
00901     BlackBoxMapType::const_iterator i;
00902     for (i=mBlackBoxMap.begin();
00903          i!=mBlackBoxMap.end();
00904          ++i) 
00905       {
00906         i->second->Check(true);
00907       }
00908     bbtkMessage("debug",1,"****** Checking Package "<<(void*)this
00909                 <<" ["<<GetName()<<"] ... OK"<<std::endl);
00910   }

Here is the call graph for this function:

void bbtk::Package::UnLoad ( Package::WeakPointer  p  )  [static, private]

Does unload a package (no test).

Definition at line 641 of file bbtkPackage.cxx.

References bbtkDebugMessage, mDLDeletePackageFunction, and mDynamicLibraryHandler.

Referenced by UnLoadDynamicLibrary(), and UnLoadReleasedDynamicallyLoadedPackages().

00642   {
00643     std::string packname = pack.lock()->GetName();
00644     bbtkDebugMessage("package",6,"==> Package::UnLoad("<<packname<<")"<<std::endl);
00645 
00646     Package* p = pack.lock().get();
00647     
00648     DynamicLibraryHandler h = p->mDynamicLibraryHandler;
00649     
00650     // deletes the package
00651     p->mDLDeletePackageFunction();
00652     
00653     // closes the dl handler
00654 #if defined(__GNUC__)  
00655     dlclose(h);  
00656 #elif defined(_WIN32)
00657     FreeLibrary(h);
00658 #endif
00659 
00660     bbtkDebugMessage("package",1,"==> dynamic library for package '"
00661                      <<packname<<"' closed"
00662                      <<std::endl);    
00663     bbtkDebugMessage("package",6,"   ... dynamic library unloaded"<<std::endl);
00664   }

Here is the caller graph for this function:

long bbtk::Object::GetUseCount (  )  [inline, inherited]

Definition at line 63 of file bbtkObject.h.

00063 { return mThisPointer.use_count(); }

void bbtk::Object::InsertInObjectList ( Pointer  p  )  [static, inherited]

Definition at line 59 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgObjectList.

00060   { 
00061     bbtkDebugMessage("object",9,"##> Object::InsertInObjectList(\""
00062                      <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl);
00063     boost::weak_ptr<Object> w(p);
00064     mgObjectList.insert(w); 
00065   }

void bbtk::Object::RemoveFromObjectList ( WeakPointer  p  )  [static, inherited]

Definition at line 80 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgObjectList.

00081   { 
00082     bbtkDebugMessage("object",9,"##> Object::RemoveFromObjectList()"
00083                      <<std::endl);
00084     mgObjectList.erase(p);
00085 
00086   }

void bbtk::Object::InsertInPackageList ( Pointer  p  )  [static, inherited]

Definition at line 69 of file bbtkObject.cxx.

References bbtkDebugMessage, and bbtk::Object::mgPackageList.

00070   { 
00071     bbtkDebugMessage("object",9,"##> Object::InsertInPackageList(\""
00072                      <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl);
00073     boost::weak_ptr<Object> w(p);
00074     mgPackageList.insert(w); 
00075   }

void bbtk::Object::ReleasePackages (  )  [static, inherited]

Definition at line 213 of file bbtkObject.cxx.

References bbtkDebugMessage, bbtk::i, and bbtk::Object::mgPackageList.

00214   {
00215     bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl);
00216     // Release package pointers
00217     ObjectListType::iterator i;
00218     for (i = mgPackageList.begin();
00219          i!= mgPackageList.end();
00220          ++i)
00221       {
00222         if (i->use_count() != 0) 
00223           { 
00224             bbtkDebugMessage("object",1,"##> Releasing package '"<<
00225                              i->lock()->GetThisPointer<Package>()->GetName()
00226                              <<"'"<<std::endl);
00227             //      Object::Pointer p(i->lock());
00228             Package::WeakPointer w(i->lock()->GetThisPointer<Package>());
00229             Package::Release(w);
00230             /*
00231             if (p->GetObjectName().find(name) != std::string::npos ) 
00232               {
00233                 std::cout << n << "/" << mgObjectList.size() << " ";
00234                 PrintObjectInfo(p);
00235                 m += p->GetObjectSize();
00236                 n++;
00237               }
00238             */
00239           }
00240       }  
00241 
00242   }

void bbtk::Object::PrintObjectListInfo ( const std::string &  name  )  [static, inherited]

Definition at line 105 of file bbtkObject.cxx.

References bbtk::i, bbtk::Object::mgObjectList, and bbtk::Object::PrintObjectInfo().

00106   {
00107     
00108     std::cout 
00109       << "=============== Living bbtk::Object pointers ========="<<std::endl;
00110 
00111     long n = 0;
00112     long u = 0;
00113     size_t m = 0;
00114     ObjectListType::iterator i;
00115     for (i = mgObjectList.begin();
00116          i!=mgObjectList.end();
00117          ++i)
00118       {
00119         if (i->use_count() == 0) 
00120           {
00121             u++;
00122           }
00123         else 
00124           { 
00125             Object::Pointer p(i->lock());
00126             if (p->GetObjectName().find(name) != std::string::npos ) 
00127               {
00128                 std::cout << n << "/" << mgObjectList.size() << " ";
00129                 PrintObjectInfo(p);
00130                 m += p->GetObjectSize();
00131                 n++;
00132               }
00133           }
00134       }
00135     std::cout 
00136       << "------------------------------------------------------"<<std::endl; 
00137 
00138     std::cout << " Total : "<<n<<" objects - "<<m<<" b"<<std::endl;
00139     if (u==1)
00140       {
00141         std::cout<<"* Note : "<<u
00142                  <<" object in list has 0 ref count, "
00143                  <<"i.e. destroyed without removing itself from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl;
00144       }
00145     else if (u>1)
00146       {
00147         std::cout<<"* Note : "<<u
00148                  <<" objects in list have 0 ref count, "
00149                  <<"i.e. destroyed without removing themselves from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl;
00150       }
00151     std::cout
00152       << "============ EO Living bbtk::Object pointers ========="<<std::endl;
00153         
00154   }

Here is the call graph for this function:

void bbtk::Object::PrintObjectInfo ( const Pointer &  o  )  [static, inherited]

Definition at line 180 of file bbtkObject.cxx.

Referenced by bbtk::Object::PrintObjectListInfo().

00181   {
00182     std::cout << "* [" << p << "] \t" 
00183               << p.use_count()-1 << " r \t"
00184               << p->GetObjectRecursiveSize() << " ("
00185               << p->GetObjectSize() << ") b \t"
00186               << p->GetObjectName() 
00187               << std::endl;
00188     std::cout << p->GetObjectInfo();
00189   }

Here is the caller graph for this function:

static long bbtk::Object::GetObjectsCount (  )  [inline, static, inherited]

Definition at line 75 of file bbtkObject.h.

00075 { return mgObjectList.size(); }

void bbtk::Object::LockThis (  )  [inline, protected, inherited]

Definition at line 88 of file bbtkObject.h.

00088 { mThisPointerLocked = mThisPointer.lock(); }   

void bbtk::Object::UnLockThis (  )  [inline, protected, inherited]

Definition at line 89 of file bbtkObject.h.

00089 { mThisPointerLocked = Pointer(); }

template<class U>
boost::shared_ptr<U> bbtk::Object::GetThisPointer (  )  const [inline, protected, inherited]

Definition at line 92 of file bbtkObject.h.

00093     {
00094       return boost::dynamic_pointer_cast<U>(mThisPointer.lock());
00095     }

template<class U>
static boost::shared_ptr<U> bbtk::Object::MakePointer ( U *  s,
bool  lock = false 
) [inline, static, protected, inherited]

Definition at line 97 of file bbtkObject.h.

Referenced by bbtk::Executer::Executer(), bbtk::Interpreter::Init(), bbtk::Transcriptor::New(), New(), bbtk::Interpreter::New(), bbtk::Factory::New(), and bbtk::Executer::New().

00098     {                                                                   
00099       if (s->mThisPointer.lock())                                       
00100         {                                                               
00101           boost::shared_ptr<U> p = s->GetThisPointer<U>();
00102           if (!lock) s->mThisPointerLocked.reset();
00103           return p;
00104         }                                                               
00105       boost::shared_ptr<U> p = boost::shared_ptr<U>(s,Object::Deleter());
00106       static_cast<Object::Deleter*>                                     
00107         (p._internal_get_deleter(typeid(Object::Deleter)))              
00108         ->mPointer = p;                                                 
00109       s->mThisPointer = p;                                              
00110       Object::InsertInObjectList(p);                                    
00111       if (lock) s->LockThis();                                          
00112       return p;                                                 
00113     }                                                                   

Here is the caller graph for this function:

template<class U, class D>
static boost::shared_ptr<U> bbtk::Object::MakePointer ( U *  s,
const D &  del,
bool  lock = false 
) [inline, static, protected, inherited]

Definition at line 115 of file bbtkObject.h.

00118     {                                                                   
00119       if (s->mThisPointer.lock())                                       
00120         {                                                               
00121           boost::shared_ptr<U> p = s->GetThisPointer<U>();
00122           if (!lock) s->mThisPointerLocked.reset();
00123           return p;
00124         }                                                               
00125       boost::shared_ptr<U> p = boost::shared_ptr<U>(s,del);
00126       static_cast<D*>                                   
00127         (p._internal_get_deleter(typeid(D)))            
00128         ->mPointer = p;                                                 
00129       s->mThisPointer = p;                                              
00130       Object::InsertInObjectList(p);                                    
00131       if (lock) s->LockThis();                                          
00132       return p;                                                 
00133     }                                                                   


Friends And Related Function Documentation

friend struct Object::Deleter [friend]

Definition at line 54 of file bbtkPackage.h.


Member Data Documentation

DynamicLibraryHandler bbtk::Package::mDynamicLibraryHandler [private]

The dynamic library handler of the package if it was loaded from a dl.

Definition at line 250 of file bbtkPackage.h.

Referenced by GetObjectInfo(), and UnLoad().

DLDeletePackageFunction bbtk::Package::mDLDeletePackageFunction [private]

The pointer on the delete function of the package in case it was loaded from a dynamic library

Definition at line 253 of file bbtkPackage.h.

Referenced by UnLoad().

std::string bbtk::Package::mName [private]

The name of the package.

Definition at line 257 of file bbtkPackage.h.

Referenced by GetObjectName(), and ~Package().

std::string bbtk::Package::mAuthor [private]

The author of the package.

Definition at line 259 of file bbtkPackage.h.

std::string bbtk::Package::mCategory [private]

The categories of the package.

Definition at line 261 of file bbtkPackage.h.

std::string bbtk::Package::mDescription [private]

The description of the package.

Definition at line 263 of file bbtkPackage.h.

std::string bbtk::Package::mVersion [private]

The version of the package.

Definition at line 265 of file bbtkPackage.h.

std::string bbtk::Package::mDocURL [private]

URL of the documentation of the Package (absolute path).

Definition at line 267 of file bbtkPackage.h.

std::string bbtk::Package::mDocRelativeURL [private]

URL of the documentation of the Package (path relative to bbtk doc root)

Definition at line 270 of file bbtkPackage.h.

BlackBoxMapType bbtk::Package::mBlackBoxMap [private]

AdaptorMapType bbtk::Package::mAdaptorMap [private]

The map of adaptors descriptors.

Definition at line 276 of file bbtkPackage.h.

Referenced by CreateHtmlPage(), FindAdaptor(), FindWidgetAdaptor(), NewAdaptor(), NewWidgetAdaptor(), and RegisterBlackBox().

FactorySet bbtk::Package::mFactorySet [private]

The set of factories which contain the package.

Definition at line 280 of file bbtkPackage.h.

std::set< Package::WeakPointer > bbtk::Package::mReleasedDynamicallyLoadedPackages [static, private]

The set of released dynamically loaded packages to be unloaded explicitely calling UnLoadReleasedDynamicallyLoadedPackages

Definition at line 286 of file bbtkPackage.h.

Referenced by UnLoadDynamicLibrary(), and UnLoadReleasedDynamicallyLoadedPackages().


The documentation for this class was generated from the following files:

Generated on Wed Nov 12 11:38:51 2008 for BBTK by  doxygen 1.5.6