[opengtl-commits] [477] split Kernel into Kernel and Library

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 477
Author:   cyrille
Date:     2008-11-15 00:40:26 +0100 (Sat, 15 Nov 2008)

Log Message:
-----------
split Kernel into Kernel and Library

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.h

Added Paths:
-----------
    trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
    trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h
    trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt	2008-11-11 23:25:28 UTC (rev 476)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt	2008-11-14 23:40:26 UTC (rev 477)
@@ -13,6 +13,7 @@
   PixelVisitor_p.cpp
   PixelConvertExpressionFactory_p.cpp
   Kernel_p.cpp
+  Library.cpp
 # Wrap
   wrappers/ImageWrap_p.cpp
   wrappers/PixelWrap_p.cpp

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-11-11 23:25:28 UTC (rev 476)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-11-14 23:40:26 UTC (rev 477)
@@ -42,20 +42,15 @@
 #include "Wrapper_p.h"
 #include "wrappers/ImageWrap_p.h"
 #include "wrappers/RegionWrap_p.h"
+#include "Library_p.h"
 
 #include "Kernel_p.h"
 
 using namespace OpenShiva;
 
-Kernel::Kernel(const GTLCore::String& _name, int _channelsNb ) : d(new Private )
+Kernel::Kernel(const GTLCore::String& _name, int _channelsNb ) : Library( true, _channelsNb), d(new Private )
 {
   d->self = this;
-  d->name = _name;
-  d->compiled = false;
-  d->enableHydraCompatibility = false;
-  d->moduleProvider = 0;
-  d->m_moduleData = 0;
-  d->count_channels_generic = _channelsNb;
   d->evaluatePixelesFunction = 0;
   d->wrapper = 0;
 }
@@ -63,91 +58,31 @@
 Kernel::~Kernel()
 {
   cleanup();
+  delete d->wrapper;
   delete d;
 }
 
 void Kernel::cleanup()
 {
-  if(d->moduleProvider)
-  {
-    GTLCore::VirtualMachine::instance()->unregisterModule( d->moduleProvider);
-    delete d->moduleProvider;
-    d->moduleProvider = 0;
-  }
-  delete d->m_moduleData;
-  delete d->wrapper;
-  d->m_moduleData = 0;
+  Library::cleanup();
   d->evaluatePixelesFunction = 0; // It's deleted by the moduleData
 }
 
-
-const GTLCore::String& Kernel::name() const
+void Kernel::postCompilation()
 {
-  return d->name;
-}
-
-void Kernel::setSource(const GTLCore::String& _source, bool _enableHydraCompatibility )
-{
-  d->enableHydraCompatibility = _enableHydraCompatibility;
-  d->source = _source;
-}
-
-void Kernel::loadFromFile(const GTLCore::String& _fileName)
-{
-  d->source = "";
-  std::ifstream in;
-  in.open(_fileName.c_str() );
-  if(not in)
+  // Create a wrapper
+  d->wrapper = new Wrapper(this, Library::d->m_moduleData);
+  d->determineTypes();
+  // Create the generateEvaluatePixeles LLVM function
+  d->evaluatePixelesFunction = CodeGenerator::generateEvaluatePixeles( this, Library::d->count_channels_generic );
+  // Call evaluateDepends as needed
+  GTLCore::Function* evaluateDependentsFunc = Library::d->m_moduleData->function( "MyKernel", "evaluateDependents");
+  if( evaluateDependentsFunc )
   {
-    SHIVA_DEBUG( "Impossible to open file " << _fileName );
-    return;
-  }
-  GTLCore::String str;
-  std::getline(in,str);
-  while ( in ) {
-    d->source += str;
-    d->source += "\n";
-    std::getline(in,str);
-  }
-}
 
-void Kernel::compile()
-{
-  if(d->source.empty()) return;
-  cleanup();
-  d->m_moduleData = new GTLCore::ModuleData(new llvm::Module(d->name));
-  Compiler c;
-  Wrapper::fillTypeManager( d->m_moduleData, d->m_moduleData->typeManager(), c.convertCenter() , d->count_channels_generic );
-  GTLCore::String nameSpace;
-  bool result = c.compile( d->source, d->name, d->m_moduleData, nameSpace );
-
-  if(result)
-  {
-    d->compiled = true;
-    // Register the compiled module in the virtual machine
-    d->moduleProvider = new llvm::ExistingModuleProvider( d->m_moduleData->llvmModule() );
-    GTLCore::VirtualMachine::instance()->registerModule( d->moduleProvider );
-    
-    // Create a wrapper
-    d->wrapper = new Wrapper(this, d->m_moduleData);
-    d->determineTypes();
-    // Create the generateEvaluatePixeles LLVM function
-    d->evaluatePixelesFunction = CodeGenerator::generateEvaluatePixeles( this, d->count_channels_generic );
-    d->name = nameSpace;
-    // Call evaluateDepends as needed
-    GTLCore::Function* evaluateDependentsFunc = d->m_moduleData->function( "MyKernel", "evaluateDependents");
-    if( evaluateDependentsFunc )
-    {
-
-      void (*func)() = (void (*)())GTLCore::VirtualMachine::instance()->getPointerToFunction( evaluateDependentsFunc, 0 );
-      (*func)();
-    }
-
-  } else {
-    cleanup();
-    d->compilationErrors = c.errorMessages();
+    void (*func)() = (void (*)())GTLCore::VirtualMachine::instance()->getPointerToFunction( evaluateDependentsFunc, 0 );
+    (*func)();
   }
-  
 }
 
 void Kernel::evaluatePixeles( const GTLCore::Region& _region, const std::list< GTLCore::AbstractImage* >& _inputImages, GTLCore::AbstractImage* _outputImage) const
@@ -185,7 +120,7 @@
 int Kernel::runTest() const
 {
   SHIVA_ASSERT( isCompiled() );
-  const GTLCore::Function* f = d->m_moduleData->function( "MyKernel", "runTest");
+  const GTLCore::Function* f = Library::d->m_moduleData->function( "MyKernel", "runTest");
   SHIVA_ASSERT( f );
   GTLCore::Value v = f->call( std::vector< GTLCore::Value >() );
   return v.asInt32();
@@ -193,12 +128,12 @@
 
 bool Kernel::hasTestFunction() const
 {
-  return d->m_moduleData->function( "MyKernel", "runTest");
+  return Library::d->m_moduleData->function( "MyKernel", "runTest");
 }
 
 GTLCore::Region Kernel::needed( GTLCore::Region output_region, int input_index, const std::list< GTLCore::Region>& input_DOD)
 {
-  GTLCore::Function* neededFunction = d->m_moduleData->function( "MyKernel", "needed");
+  GTLCore::Function* neededFunction = Library::d->m_moduleData->function( "MyKernel", "needed");
   RegionWrap* (*func)( RegionWrap*, int, ArrayWrap* ) = ( RegionWrap* (*)( RegionWrap*, int, ArrayWrap* ) )GTLCore::VirtualMachine::instance()->getPointerToFunction( neededFunction, 3);
   RegionWrap* rwrap = (*func)( regionToRegionWrap( output_region ), input_index, regionListToArrayWrap( input_DOD ) );
   
@@ -209,12 +144,12 @@
 
 bool Kernel::hasNeededFunction() const
 {
-  return d->m_moduleData->function( "MyKernel", "needed");
+  return Library::d->m_moduleData->function( "MyKernel", "needed");
 }
 
 GTLCore::Region Kernel::changed( GTLCore::Region changed_input_region, int input_index, const std::list< GTLCore::Region>& input_DOD)
 {
-  GTLCore::Function* changedFunction = d->m_moduleData->function( "MyKernel", "changed");
+  GTLCore::Function* changedFunction = Library::d->m_moduleData->function( "MyKernel", "changed");
   RegionWrap* (*func)( RegionWrap*, int, ArrayWrap* ) = ( RegionWrap* (*)( RegionWrap*, int, ArrayWrap* ) )GTLCore::VirtualMachine::instance()->getPointerToFunction( changedFunction, 3);
   RegionWrap* rwrap = (*func)( regionToRegionWrap( changed_input_region ), input_index, regionListToArrayWrap( input_DOD ) );
   
@@ -225,12 +160,12 @@
 
 bool Kernel::hasChangedFunction() const
 {
-  return d->m_moduleData->function( "MyKernel", "changed");
+  return Library::d->m_moduleData->function( "MyKernel", "changed");
 }
 
 GTLCore::Region Kernel::generated()
 {
- GTLCore::Function* f = d->m_moduleData->function( "MyKernel", "generated");
+ GTLCore::Function* f = Library::d->m_moduleData->function( "MyKernel", "generated");
  SHIVA_ASSERT( f );
 
  RegionWrap* (*func)() = (RegionWrap* (*)())GTLCore::VirtualMachine::instance()->getPointerToFunction( f, 0 );
@@ -243,41 +178,5 @@
 
 bool Kernel::hasGeneratedFunction() const
 {
-  return d->m_moduleData->function( "MyKernel", "generated");
+  return Library::d->m_moduleData->function( "MyKernel", "generated");
 }
-
-
-GTLCore::String Kernel::compilationErrorsMessage() const
-{
-  std::ostringstream os;
-  for( std::list<GTLCore::ErrorMessage>::iterator it = d->compilationErrors.begin();
-       it != d->compilationErrors.end(); ++it)
-  {
-    os << it->fileName() << " at " << it->line() << " : " << it->errorMessage()  << std::endl;
-  }
-  return os.str();
-}
-
-
-bool Kernel::isCompiled() const
-{
-  return d->compiled;
-}
-
-const std::list<GTLCore::ErrorMessage>& Kernel::compilationErrors() const
-{
-  return d->compilationErrors;
-}
-
-GTLCore::String Kernel::asmSourceCode() const
-{
-  std::ostringstream os;
-  os << *d->m_moduleData->llvmModule() << std::endl;
-  return os.str();
-}
-
-GTLCore::String Kernel::cSourceCode() const
-{
-  return d->m_moduleData->asCCode();
-}
-

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-11-11 23:25:28 UTC (rev 476)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-11-14 23:40:26 UTC (rev 477)
@@ -24,12 +24,11 @@
 
 namespace GTLCore {
   class AbstractImage;
-  class ErrorMessage;
   class ModuleData;
   class Region;
 }
 
-#include <GTLCore/String.h>
+#include <OpenShiva/Library.h>
 
 namespace OpenShiva {
   /**
@@ -38,50 +37,14 @@
    * 
    * @ingroup OpenShiva
    */
-  class Kernel {
+  class Kernel : public Library {
     friend class CodeGenerator;
     public:
       Kernel(const GTLCore::String& _name, int _channelsNb = 4 );
       ~Kernel();
     private:
-      void cleanup();
-    public:
-      /**
-       * @return the name of the kernel
-       */
-      const GTLCore::String& name() const;
-      /**
-       * Set the code source of the module.
-       */
-      void setSource(const GTLCore::String& source, bool _enableHydraCompatibility = false);
-      /**
-       * Load the module from the given file name.
-       */
-      void loadFromFile(const GTLCore::String& fileName);
-      /**
-       * Start the compilation of the module.
-       */
-      void compile();
-      /**
-       * @return true if the module was successfully compiled.
-       */
-      bool isCompiled() const;
-      /**
-       * @return a string with the content of the compilation error.
-       */
-      const std::list<GTLCore::ErrorMessage>& compilationErrors() const;
-      /**
-       * @return a string with the content of the compilation error.
-       */
-      GTLCore::String compilationErrorsMessage() const;
-      /**
-       * @return the assembly source code, it's mostly usefull for testing purpose
-       */
-      GTLCore::String asmSourceCode() const;
-      /**
-       * @return the C source code, it's mostly usefull for testing purpose
-       */
-      GTLCore::String cSourceCode() const;
+      virtual void cleanup();
+      virtual void postCompilation();
     public: // Function call
       void evaluatePixeles( const GTLCore::Region& _region, const std::list< GTLCore::AbstractImage* >& _inputImages, GTLCore::AbstractImage* _outputImage) const;
       /**

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp	2008-11-11 23:25:28 UTC (rev 476)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.cpp	2008-11-14 23:40:26 UTC (rev 477)
@@ -29,21 +29,23 @@
 
 #include "Debug.h"
 
+#include "Library_p.h"
+
 using namespace OpenShiva;
 
-Kernel::Private::Private() : m_moduleData(0)
+Kernel::Private::Private()
 {
 }
 
 GTLCore::ModuleData* Kernel::Private::moduleData()
 {
-  return m_moduleData;
+  return self->Library::d->m_moduleData;
 }
 
 void Kernel::Private::determineTypes()
 {
   m_inputsTypes.clear();
-  GTLCore::Function* ePFunction = m_moduleData->function( self->name(), "evaluatePixel" );
+  GTLCore::Function* ePFunction = self->Library::d->m_moduleData->function( self->name(), "evaluatePixel" );
   bool hasOutput = false;
   foreach( GTLCore::Parameter arg, ePFunction->parameters() )
   {
@@ -56,9 +58,9 @@
       SHIVA_ASSERT( m_outputPixelType->structName().head( 5 ) == "pixel" );
       if(  m_outputPixelType->structName() == "pixel" )
       {
-        m_outputImageType = m_moduleData->typeManager()->getStructure( "image" );
+        m_outputImageType = self->Library::d->m_moduleData->typeManager()->getStructure( "image" );
       } else {
-        m_outputImageType = m_moduleData->typeManager()->getStructure( "image" + m_outputPixelType->structName().tail(1) );
+        m_outputImageType = self->Library::d->m_moduleData->typeManager()->getStructure( "image" + m_outputPixelType->structName().tail(1) );
       }
       GTL_ASSERT( m_outputImageType );
     } else {

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.h	2008-11-11 23:25:28 UTC (rev 476)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel_p.h	2008-11-14 23:40:26 UTC (rev 477)
@@ -25,7 +25,6 @@
 #include <list>
 
 namespace llvm {
-  class ModuleProvider;
   class Function;
 }
 
@@ -49,15 +48,7 @@
        */
       void determineTypes();
       Kernel* self;
-      GTLCore::String name;
-      GTLCore::String source;
-      bool enableHydraCompatibility;
-      bool compiled;
-      std::list<GTLCore::ErrorMessage> compilationErrors;
-      llvm::ModuleProvider* moduleProvider;
-      GTLCore::ModuleData* m_moduleData;
       llvm::Function* evaluatePixelesFunction;
-      int count_channels_generic;
       Wrapper* wrapper;
       std::list< const GTLCore::Type* > m_inputsTypes;
       const GTLCore::Type* m_outputPixelType;

Copied: trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp (from rev 468, trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp)
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp	2008-11-14 23:40:26 UTC (rev 477)
@@ -0,0 +1,171 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "Library.h"
+#include "Library_p.h"
+
+#include <sstream>
+#include <fstream>
+
+#include <llvm/Module.h>
+#include <llvm/ModuleProvider.h>
+
+#include "GTLCore/ErrorMessage.h"
+#include "GTLCore/Function.h"
+#include "GTLCore/ModuleData_p.h"
+#include "GTLCore/PixelDescription.h"
+#include "GTLCore/Region.h"
+#include "GTLCore/Type.h"
+#include "GTLCore/TypeManager.h"
+#include "GTLCore/Value.h"
+#include "GTLCore/VirtualMachine_p.h"
+#include "GTLCore/wrappers/Allocate.h"
+
+#include "Debug.h"
+#include "CodeGenerator_p.h"
+#include "Compiler_p.h"
+#include "Wrapper_p.h"
+#include "wrappers/ImageWrap_p.h"
+#include "wrappers/RegionWrap_p.h"
+
+#include "Kernel_p.h"
+
+using namespace OpenShiva;
+
+Library::Library( bool _isKernel , int _channelsNb) : d(new Private)
+{
+  d->name = "";
+  d->compiled = false;
+  d->moduleProvider = 0;
+  d->m_moduleData = 0;
+  d->count_channels_generic = _channelsNb;
+}
+
+Library::~Library()
+{
+  cleanup();
+  delete d;
+}
+
+void Library::cleanup()
+{
+  if(d->moduleProvider)
+  {
+    GTLCore::VirtualMachine::instance()->unregisterModule( d->moduleProvider);
+    delete d->moduleProvider;
+    d->moduleProvider = 0;
+  }
+  delete d->m_moduleData;
+  d->m_moduleData = 0;
+}
+
+
+const GTLCore::String& Library::name() const
+{
+  return d->name;
+}
+
+void Library::setSource(const GTLCore::String& _source )
+{
+  d->source = _source;
+}
+
+void Library::loadFromFile(const GTLCore::String& _fileName)
+{
+  d->source = "";
+  std::ifstream in;
+  in.open(_fileName.c_str() );
+  if(not in)
+  {
+    SHIVA_DEBUG( "Impossible to open file " << _fileName );
+    return;
+  }
+  GTLCore::String str;
+  std::getline(in,str);
+  while ( in ) {
+    d->source += str;
+    d->source += "\n";
+    std::getline(in,str);
+  }
+}
+
+void Library::postCompilation()
+{
+}
+
+void Library::compile()
+{
+  if(d->source.empty()) return;
+  cleanup();
+  d->m_moduleData = new GTLCore::ModuleData(new llvm::Module(d->name));
+  Compiler c;
+  Wrapper::fillTypeManager( d->m_moduleData, d->m_moduleData->typeManager(), c.convertCenter() , d->count_channels_generic );
+  GTLCore::String nameSpace;
+  bool result = c.compile( d->source, d->name, d->m_moduleData, nameSpace );
+
+  if(result)
+  {
+    d->compiled = true;
+    // Register the compiled module in the virtual machine
+    d->moduleProvider = new llvm::ExistingModuleProvider( d->m_moduleData->llvmModule() );
+    GTLCore::VirtualMachine::instance()->registerModule( d->moduleProvider );
+    postCompilation();
+    d->name = nameSpace;
+
+  } else {
+    cleanup();
+    d->compilationErrors = c.errorMessages();
+  }
+  
+}
+
+GTLCore::String Library::compilationErrorsMessage() const
+{
+  std::ostringstream os;
+  for( std::list<GTLCore::ErrorMessage>::iterator it = d->compilationErrors.begin();
+       it != d->compilationErrors.end(); ++it)
+  {
+    os << it->fileName() << " at " << it->line() << " : " << it->errorMessage()  << std::endl;
+  }
+  return os.str();
+}
+
+
+bool Library::isCompiled() const
+{
+  return d->compiled;
+}
+
+const std::list<GTLCore::ErrorMessage>& Library::compilationErrors() const
+{
+  return d->compilationErrors;
+}
+
+GTLCore::String Library::asmSourceCode() const
+{
+  std::ostringstream os;
+  os << *d->m_moduleData->llvmModule() << std::endl;
+  return os.str();
+}
+
+GTLCore::String Library::cSourceCode() const
+{
+  return d->m_moduleData->asCCode();
+}
+


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/Library.cpp
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library.h	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library.h	2008-11-14 23:40:26 UTC (rev 477)
@@ -0,0 +1,81 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _OPENSHIVA_LIBRARY_H_
+#define _OPENSHIVA_LIBRARY_H_
+
+#include <GTLCore/String.h>
+
+namespace GTLCore {
+  class ErrorMessage;
+}
+
+namespace OpenShiva {
+  class Library {
+    friend class Kernel;
+    friend class LibraryManager;
+      Library( bool _isKernel, int _channelsNb );
+      ~Library();
+    private:
+      virtual void cleanup();
+      virtual void postCompilation();
+    public:
+      /**
+       * @return the name of the kernel
+       */
+      const GTLCore::String& name() const;
+      /**
+       * Set the code source of the module.
+       */
+      void setSource(const GTLCore::String& source);
+      /**
+       * Load the module from the given file name.
+       */
+      void loadFromFile(const GTLCore::String& fileName);
+      /**
+       * Start the compilation of the module.
+       */
+      void compile();
+      /**
+       * @return true if the module was successfully compiled.
+       */
+      bool isCompiled() const;
+      /**
+       * @return a string with the content of the compilation error.
+       */
+      const std::list<GTLCore::ErrorMessage>& compilationErrors() const;
+      /**
+       * @return a string with the content of the compilation error.
+       */
+      GTLCore::String compilationErrorsMessage() const;
+      /**
+       * @return the assembly source code, it's mostly usefull for testing purpose
+       */
+      GTLCore::String asmSourceCode() const;
+      /**
+       * @return the C source code, it's mostly usefull for testing purpose
+       */
+      GTLCore::String cSourceCode() const;
+    private:
+      struct Private;
+      Private* const d;
+  };
+}
+
+#endif


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/Library.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp	2008-11-14 23:40:26 UTC (rev 477)
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "LibraryManager.h"
+#include "LibraryManager_p.h"
+
+using namespace OpenShiva;
+
+LibraryManager::LibraryManager()
+{
+}
+
+void LibraryManager::addDirectory(const GTLCore::String& directory)
+{
+  
+}


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h	2008-11-14 23:40:26 UTC (rev 477)
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _OPENSHIVA_LIBRARY_MANAGER_H_
+#define _OPENSHIVA_LIBRARY_MANAGER_H_
+
+namespace OpenShiva {
+  /**
+   * @ingroup OpenShiva
+   */
+  class LibraryManager {
+    private:
+      LibraryManager();
+      ~LibraryManager();
+    public:
+      
+      /**
+       * Add a directory to the list of directory that get searched for library.
+       */
+      void addDirectory(const GTLCore::String& directory);
+    public:
+      /**
+       * @return the instance to the singleton \ref LibraryManager
+       */
+      static LibraryManager* instance();
+    private:
+      struct Private;
+      Private* const d;
+  };
+  
+};
+
+#endif


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h	2008-11-14 23:40:26 UTC (rev 477)
@@ -0,0 +1,36 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _OPENSHIVA_LIBRARY_MANAGER_P_H_
+#define _OPENSHIVA_LIBRARY_MANAGER_P_H_
+
+#include "LibraryManager.h"
+
+namespace OpenShiva {
+
+  struct LibraryManger::Private {
+//   std::map<GTLCore::String, Module*> modules;
+    std::list<GTLCore::String> directories;
+    static LibraryManger* s_instance;
+    
+  };
+
+}
+
+#endif


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/LibraryManager_p.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h	2008-11-14 23:40:26 UTC (rev 477)
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _OPENSHIVA_LIBRARY_P_H_
+#define _OPENSHIVA_LIBRARY_P_H_
+
+#include "Library.h"
+
+namespace llvm {
+  class ModuleProvider;
+  class Function;
+}
+
+namespace GTLCore {
+  class ModuleData;
+}
+
+namespace OpenShiva {
+  struct Library::Private {
+    Private() : m_moduleData(0)
+    {
+    }
+    GTLCore::String name;
+    GTLCore::String source;
+    bool compiled;
+    std::list<GTLCore::ErrorMessage> compilationErrors;
+    llvm::ModuleProvider* moduleProvider;
+    GTLCore::ModuleData* m_moduleData;
+    int count_channels_generic;
+  };
+}
+
+#endif


Property changes on: trunk/OpenGTL/OpenShiva/OpenShiva/Library_p.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/