13 #include <ecl/config/ecl.hpp> 
   25 #include "../../include/ecl/devices/shared_file.hpp" 
   53                 if ( !file.open(name,mode) ) {
 
   54                         error_handler = file.error();
 
   57                 error_handler = file.error();
 
   66 Mutex SharedFileManager::mutex;
 
   67 std::map<string,SharedFileCommon*> SharedFileManager::opened_files;
 
   76         std::map<std::string,SharedFileCommon*>::iterator iter = opened_files.find(name);
 
   78         if ( iter != opened_files.end() ) {
 
   82         iter->second->
count += 1;
 
   83         shared_instance = iter->second;
 
   90                 opened_files.insert(std::pair<string,SharedFileCommon*>(name,shared_instance));
 
   92                 shared_instance = NULL;
 
   97     return shared_instance;
 
  104 bool SharedFileManager::DeRegisterSharedFile(
const std::string& name) {
 
  107         std::map<std::string,SharedFileCommon*>::iterator iter = opened_files.find(name);
 
  109         if ( iter == opened_files.end() ) {
 
  110                 ecl_throw(StandardException(LOC,CloseError,
"The specified shared object file could not be closed - was not found."));
 
  113     if ( iter->second->count == 1 ) {
 
  115         opened_files.erase(iter);
 
  117         iter->second->count -= 1;
 
  135 SharedFile::SharedFile(
const std::string &name, 
WriteMode mode) :
 
  136         shared_instance(NULL)
 
  158                 if ( shared_instance == NULL ) {
 
  172         long n = buffer.append(c);
 
  173         if ( buffer.full() ) {
 
  182         unsigned int no_written = 0;
 
  183         while ( no_written < n ) {
 
  184                 no_written += buffer.append(s+no_written,n-no_written);
 
  185                 if ( buffer.full() ) {
 
  197                 written = shared_instance->
file.write(buffer.c_ptr(), buffer.size() );