+ /// Creates a new package
+ static Pointer New(const std::string& name,
+ const std::string& author,
+ const std::string& description,
+ const std::string& version);
+ /// Creates a package from a dynamic library
+ static Pointer CreateFromDynamicLibrary(const std::string& libname,
+ const std::string& pkgname,
+ const std::string& path);
+
+ /// NOTE : All the static methods below for package destruction
+ /// are not member because they can cause the package death
+ /// and thus close the dynamic library from which it has been loaded.
+ /// If the dynamic lib which provides a function is closed while
+ /// in the function: imagine the crash !
+ /// The principal method is Release
+
+ /// 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
+ static void UnLoadDynamicLibrary(Package::WeakPointer p, bool doit = true);
+
+ /// UnLoads released packages that were loaded dynamically
+ /// see UnLoadDynamicLibrary and ReleaseBlackBoxDescriptor
+ static void UnLoadReleasedDynamicallyLoadedPackages();
+
+ /// "Releases" the package
+ /// Signals the package that it can free its descriptors
+ /// if they are no more used
+ /// then frees and unloads the package
+ /// if it is no more used (released)
+ /// Note : Any non-weak pointer on the package must have been freed
+ static void Release(Package::WeakPointer p);
+
+
+ /// Registers the BlackBoxDescriptor in the Package
+ bool Register(BlackBoxDescriptor::Pointer);
+
+ /// "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
+ static void ReleaseBlackBoxDescriptor(Package::WeakPointer p,
+ BlackBoxDescriptor::WeakPointer d);
+
+
+ typedef Package::Pointer (*DLGetPackageFunction)();
+ typedef void (*DLDeletePackageFunction)();
+ typedef const std::string& (*DLGetPackageBBTKVersionFunction)();
+
+ /// 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
+ static DynamicLibraryHandler OpenDynamicLibrary
+ ( const std::string& dynamic_library_path,
+ const std::string& package_name,
+ DLGetPackageFunction&,
+ DLDeletePackageFunction&);
+
+