New files added and fixes for VC++
This commit is contained in:
parent
6e9bdc8b2e
commit
2141b13f9d
7 changed files with 162 additions and 13 deletions
47
eo/src/eoDrawable.h
Normal file
47
eo/src/eoDrawable.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoDrawable.h
|
||||
// (c) GeNeura Team, 1999
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef EODRAWABLE_H
|
||||
#define EODRAWABLE_H
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
using namespace std;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoDrawable
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** eoDrawable is a template class that adds a drawing interface to an object.\\
|
||||
Requisites for template instantiation are that the object must admit a default ctor
|
||||
and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className,
|
||||
eoDrawables can be drawn on any two-dimensional surface; it can be added to any
|
||||
object with above characteristics.
|
||||
@see eoObject
|
||||
*/
|
||||
template <class Object>
|
||||
class eoDrawable
|
||||
{
|
||||
public:
|
||||
/// Main ctor from an already built Object.
|
||||
eoDrawable( const Object& _o): Object( _o ){};
|
||||
|
||||
/// Copy constructor.
|
||||
eoDrawable( const eoDrawable& _d): Object( _d ){};
|
||||
|
||||
/// Virtual dtor. They are needed in virtual class hierarchies
|
||||
virtual ~eoDrawable() {};
|
||||
|
||||
|
||||
/**Draws the object. It must be redefined in any subclass, it´s impossible
|
||||
to have a general drawing method
|
||||
@param _x, _y coorinates */
|
||||
virtual void draw( unsigned _x, unsigned _y) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif EODRAWABLE_H
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
#define eoLottery_h
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <values.h> // MINFLOAT
|
||||
#include <numeric> // accumulate
|
||||
|
|
|
|||
73
eo/src/eoOpSelMason.h
Normal file
73
eo/src/eoOpSelMason.h
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// eoOpSelMason.h
|
||||
// (c) GeNeura Team, 1999
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _EOOPSELMASON_H
|
||||
#define _EOOPSELMASON_H
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <eoOpSelector.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/** EO Mason, or builder, for operator selectors. A builder must allocate memory
|
||||
to the objects it builds, and then deallocate it when it gets out of scope*/
|
||||
template<class eoClass>
|
||||
class eoOpSelMason: public eoFactory<eoOpSelector<eoClass> > {
|
||||
|
||||
public:
|
||||
|
||||
/// @name ctors and dtors
|
||||
//{@
|
||||
/// constructor
|
||||
eoOpSelMason( ) {}
|
||||
|
||||
/// destructor
|
||||
virtual ~eoOpSelMason() {}
|
||||
//@}
|
||||
|
||||
/** Factory methods: creates an object from an istream, reading from
|
||||
it whatever is needed to create the object. The format is
|
||||
opSelClassName\\
|
||||
rate 1 operator1\\
|
||||
rate 2 operator2\\
|
||||
...\\
|
||||
Stores all operators built in a database (#allocMap#), so that somebody
|
||||
can destroy them later. The Mason is in charge or destroying the operators,
|
||||
since the built object can´t do it itself. The objects built must be destroyed
|
||||
from outside, using the #destroy# method
|
||||
*/
|
||||
virtual eoOpSelector<eoClass>* make(istream& _is) {
|
||||
string opSelName;
|
||||
_is >> opSelName;
|
||||
eoMonOpFactory<eoClass> selMaker;
|
||||
// read operator rate and name
|
||||
while ( _is ) {
|
||||
float rate;
|
||||
_is >> rate;
|
||||
|
||||
|
||||
// Create an stream
|
||||
strstream s0;
|
||||
eoMonOp<IEO>* op0 = selMaker.make( s0 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///@name eoObject methods
|
||||
//@{
|
||||
/** Return the class id */
|
||||
virtual string className() const { return "eoFactory"; }
|
||||
|
||||
/** Read and print are left without implementation */
|
||||
//@}
|
||||
|
||||
private:
|
||||
map<eoOpSelector<eoClass>*,vector<eoOp<eoClass>* > > allocMap;
|
||||
};
|
||||
|
||||
|
||||
#endif _EOFACTORY_H
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
modified or whatever
|
||||
@param _id a previously assigned ID
|
||||
@throw runtime_exception if the ID does not exist*/
|
||||
virtual eoOp<EOT>& getOp( ID _id ) = 0;
|
||||
virtual const eoOp<EOT>& getOp( ID _id ) = 0;
|
||||
|
||||
/** Remove an operator from the operator set
|
||||
@param _id a previously assigned ID
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ Operators are represented as pairs (proportion,operator)
|
|||
*/
|
||||
template<class EOT>
|
||||
class eoProportionalOpSel: public eoOpSelector<EOT>,
|
||||
public multimap<float,eoOp<EOT>*,greater<float> >
|
||||
public multimap<float,const eoOp<EOT>*,greater<float> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef multimap<float,eoOp<EOT>*,greater<float> > MMF;
|
||||
typedef multimap<float, const eoOp<EOT>*,greater<float> > MMF;
|
||||
|
||||
/// default ctor
|
||||
eoProportionalOpSel()
|
||||
|
|
@ -43,13 +43,14 @@ public:
|
|||
modified or whatever
|
||||
@param _id a previously assigned ID
|
||||
@throw runtime_error if the ID does not exist*/
|
||||
virtual eoOp<EOT>& getOp( ID _id ) {
|
||||
virtual const eoOp<EOT>& getOp( ID _id ) {
|
||||
MMF::iterator i=begin();
|
||||
ID j = 1;
|
||||
while ( (i++!=end()) && (j++ != _id) );
|
||||
if ( i == end() )
|
||||
throw runtime_error( "No such id in eoProportionalOpSel::op\n" );
|
||||
return *(i->second);
|
||||
//return i->second;
|
||||
}
|
||||
|
||||
/** add an operator to the operator set
|
||||
|
|
@ -100,6 +101,7 @@ public:
|
|||
if ( i == end() )
|
||||
throw runtime_error( "Operator not found in eoProportionalOpSelector" );
|
||||
return *(i->second);
|
||||
//return i->second;
|
||||
}
|
||||
|
||||
/// Methods inherited from eoObject
|
||||
|
|
@ -115,9 +117,10 @@ public:
|
|||
base classes, so you don´t have to worry about, for instance, fitness.
|
||||
@param _s the ostream in which things are written*/
|
||||
virtual void printOn( ostream& _s ) const{
|
||||
for ( MMF::const_iterator i=begin(); i!=end(); i++ ) {
|
||||
_s << i->first << "\t" << i->second << endl;
|
||||
}
|
||||
_s << className() << endl;
|
||||
for ( MMF::const_iterator i=begin(); i!=end(); i++ ) {
|
||||
_s << i->first << "\t" << *(i->second )<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,18 @@ Package=<4>
|
|||
|
||||
###############################################################################
|
||||
|
||||
Project: "t_eobin"=.\t_eobin.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "t_eoid"=.\t_eoid.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
|
@ -123,6 +135,18 @@ Package=<4>
|
|||
|
||||
###############################################################################
|
||||
|
||||
Project: "t_lottery"=.\t_lottery.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "t_opfactory"=.\t_opfactory.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ BSC32=bscmake.exe
|
|||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "t_opfactory - Win32 Debug"
|
||||
|
||||
|
|
@ -64,16 +64,16 @@ LINK32=link.exe
|
|||
# PROP Intermediate_Dir "t_opfactory___Win32_Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc0a /d "_DEBUG"
|
||||
# ADD RSC /l 0xc0a /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 eo.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 eo.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
|
|||
Reference in a new issue