Commit 0fd5ded5 authored by Francois Bleibel's avatar Francois Bleibel

Added README information. Read me! Removed the test test_factory (need to design a new one)

parent 7887e86e
See INSTALL for installation instruction.
See INSTALL for installation instructions.
The dynamic-graph library is a framework to create dynamic
graphs of generic entities connected together by signals,
with helper facilities such as signal casters, an object
factory and an object pool. It is a spin-off and was
originally part of the StackOfTasks library.
......@@ -3,14 +3,14 @@
\section intro_dynamicGraph Introduction
This code implements the g_factory design pattern, making creation of entities
This code implements the factory design pattern, making creation of entities
available to packages depending on the dynamic-graph API.
Objects, which are derived from Entities, can be
declared within the code and compiled to shared libraries (.so/.dll files).
These libraries can be loaded at run-time using the PluginLoader methods,
and at the same time register their class names to the Factory (see the
examples in the DYNAMIC-GRAPH documentation to learn how).
examples in the SOT documentation to learn how).
The Factory can then create instances of these objects and subsequently
register them in the Pool, where they can be listed, accessed, and acted upon
......
......@@ -7,7 +7,6 @@ SET(tests
test_shell
test_pool
test_depend
test_factory
test_signalcast)
FOREACH(test_name ${tests})
......
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright Projet JRL-JAPAN, Tsukuba, 2007
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* File: test_factory.cc
* Project: DYNAMIC-GRAPH
* Author: Nicolas Mansard
*
* Version control
* ===============
*
* $Id$
*
* Description
* ============
*
*
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* -------------------------------------------------------------------------- */
/* --- INCLUDES ------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
#include <string>
#include <iostream>
#include <cstdlib>
#include <sstream>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/entity.h>
#include <dynamic-graph/debug.h>
using namespace std;
using namespace dynamicgraph;
#ifdef WIN32
#include <Windows.h>
#else
#include <dlfcn.h>
#endif
#ifdef WIN32
typedef HMODULE sotPluginKey;
#else
typedef void* sotPluginKey;
#endif
int main()
{
dgDEBUG(0) << "# In {"<<endl;
// Entity test("");
// sotExceptionFeature t2(sotExceptionFeature::BAD_INIT);
// sotExceptionSignal t4(sotExceptionSignal::COPY_NOT_INITIALIZED);
// sotFlags t3;
// TestFeature t5;
#ifndef WIN32
sotPluginKey dlib = dlopen("lib/plugin/sotFeatureVisualPoint.so", RTLD_NOW);
#else
sotPluginKey dlib = LoadLibrary ( "lib/plugin/sotFeatureVisualPoint.lib");
#endif
if( NULL==dlib )
{
cerr << " Error dl"<<endl;
#ifndef WIN32
cerr << dlerror() <<endl;
#else
// Retrieve the system error message for the last-error code
LPTSTR pszMessage;
DWORD dwLastError = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszMessage,
0, NULL );
cerr << pszMessage <<endl;
LocalFree(pszMessage);
#endif
exit(0);
}
#ifndef WIN32
dlib = dlopen("lib/plugin/sotGainAdaptative.so", RTLD_NOW);
#else
dlib = LoadLibrary ("lib/plugin/sotGainAdaptative.lib");
#endif
if( NULL==dlib )
{
cout << "This test can only be run after the package StackOfTasks has been installed\n"
"Could not find sotGainAdaptive shared library" << endl;
#ifndef WIN32
cerr << dlerror() <<endl;
#else
// Retrieve the system error message for the last-error code
LPTSTR pszMessage;
DWORD dwLastError = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszMessage,
0, NULL );
cerr << pszMessage <<endl;
LocalFree(pszMessage);
#endif
exit(0);
}
Entity* gain = 0;
if ( !g_factory.existEntity("GainAdaptative") ) {
cout << "Could not find entity class 'GainAdaptative'" << endl;
exit(0);
}
else
gain = g_factory.newEntity("GainAdaptative","Gain");
gain->display(cout); cout << endl;
cout <<gain->getClassName(); cout << endl;
dgDEBUG(0) << "# Out }"<<endl;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment