Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 54cac1c2268db633d66eeff1b4faa585 > files > 11

frepple-doc-0.8.1-3.fc15.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  <title>Frepple / Extension modules </title>
  <link rel='stylesheet' href='../styles.css' type='text/css' />
  <!--PageHeaderFmt-->  
</head>
<body>
<div id="container">

<div id="menubar">
  
<div id="logo" align="center">
<br/><img src='../frepple.bmp' alt="frepple" /><br/>
<a href='http://www.frepple.com/'>
<strong>a Free<br/>Production Planning<br/>Library</strong>
</a></div>
<div id="menu">
<br/>
<h3><a href='../Main/HomePage.html'>Main</a></h3>
<h3><a href='../UI/Main.html'>User Manual</a></h3>
<h3><a href='../Tutorial/Main.html'>Tutorial</a></h3>
<h3><a href='Main.html'>Reference Manual</a></h3>
<h3><a href='../Main/FAQ.html'>FAQ</a></h3>
<h3><a href='../reference/index.html'>C++ API</a></h3>
<br/><div>
</div>  
</div>
</div>

<div id="content">
<br/>
<!--PageText-->
<div id='wikitext'>
<p><a class='wikilink' href='../Main/HomePage.html'>Main</a> &gt; <span class='wikitrail'><a class='wikilink' href='Main.html'>Reference Manual</a> > <a class='wikilink' href='Developer.html'>Information for developers</a> > <a class='selflink' href='DeveloperExtend.html'>Extension modules</a></span>
</p>
<p class='vspace'>FrePPLe is designed as an extendable framework.<br />Additional modeling and solver modules can be loaded at runtime without recompiling the library.<br />Such extension modules can be shipped with frePPLe, or can be developed by third parties. Modules can be open source or have a commercial license.
</p>
<p class='vspace'>An simple example is available in the testcase <a class='wikilink' href='TestSampleModule.html'>sample_module</a>.<br />FrePPLe currently includes three examples of such extension modules: a module implementing a python interpreter, a forecast class implementing a special type of demand, and a solver using a linear programming algorithm.
</p>
<p class='vspace'>The steps below define how a custom extension can be build on the framework. 
</p>
<div class='vspace'></div><ul><li>The proper way to build extension is by creating modules.<br />  Other ways of extending the package may technically be possible, but are not recommended.<br />  Copying the code and header structure from an existing module is the quickest and easiest start.
<div class='vspace'></div></li><li>Create your own header files, and include the frePPLe header file planner.h to have access to the frePPLe objects.<br />  A simple header file can look like this:
</li></ul><div class='vspace'></div><pre>     #include &quot;frepple.h&quot;
     using namespace frepple;

     namespace your_module
     {
        MODULE_EXPORT const char* initialize(
          const CommandLoadLibrary::ParameterList&amp; z
          );
        ...
        your classes and function definitons
        ...
     }
</pre><div class='vspace'></div><ul><li>Create your own C++ implementation files, which will include your customized header file.<br />  It is important is to include an initialize() method, and use it to register your extension in the frePPLe framework. The method is automatically called when the module is loaded.
</li></ul><div class='vspace'></div><pre>     #include &quot;your_module.h&quot;
     namespace your_module
     {

     MODULE_EXPORT const char* initialize(
       const CommandLoadLibrary::ParameterList&amp; z
       )
     {
       ...
       your initialization code goes here
       ...
     }

     your method and class implementations go here
</pre><div class='vspace'></div><ul><li>Compile your code as a loadable module.<br />  The command line options and arguments vary for each compiler and platform. For gcc I use the options 
"-module -shrext .so -avoid-version", adding also "-no-undefined" when running under Cygwin.<br />  To keep things simple and transparant please use the .so extension for you modules and place them in the $FREPPLE_HOME directory.
<div class='vspace'></div></li><li>Update the init.xml or init.py file to load your module with the "frepple.loadmodule" Python function.<br />  Keyword arguments to this function are passed to the initialize() funtion when the module is loaded.
<div class='vspace'></div></li><li>Update the file frepple.xsd by defining the XML constructs enabled by your module.<br />  To keep things clean and modular, it is recommended to do this by including a seperate xsd file rather than directly entering the definition in the file.
</li></ul><div class='vspace'></div>
</div>

<!--PageFooterFmt-->
<!--HTMLFooter-->
</div></div>
</body>
</html>