* indentations + whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 16:54:00 +02:00
commit 56c6edab04
285 changed files with 6068 additions and 6223 deletions

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// eoOpSelMason.h
// (c) GeNeura Team, 1999
/*
/*
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
@ -36,72 +36,72 @@ 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:
typedef std::vector<eoOp<eoClass>* > vOpP;
typedef map<eoOpSelector<eoClass>*, vOpP > MEV;
typedef std::vector<eoOp<eoClass>* > vOpP;
typedef map<eoOpSelector<eoClass>*, vOpP > MEV;
/// @name ctors and dtors
//{@
/// constructor
eoOpSelMason( eoOpFactory<eoClass>& _opFact): operatorFactory( _opFact ) {};
/// destructor
virtual ~eoOpSelMason() {};
//@}
/// @name ctors and dtors
//{@
/// constructor
eoOpSelMason( eoOpFactory<eoClass>& _opFact): operatorFactory( _opFact ) {};
/** Factory methods: creates an object from an std::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(std::istream& _is) {
/// destructor
virtual ~eoOpSelMason() {};
//@}
std::string opSelName;
_is >> opSelName;
eoOpSelector<eoClass>* opSelectorP;
// Build the operator selector
if ( opSelName == "eoProportionalOpSel" ) {
opSelectorP = new eoProportionalOpSel<eoClass>();
}
/** Factory methods: creates an object from an std::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(std::istream& _is) {
// Temp std::vector for storing pointers
vOpP tmpPVec;
// read operator rate and name
while ( _is ) {
float rate;
_is >> rate;
if ( _is ) {
eoOp<eoClass>* op = operatorFactory.make( _is ); // This reads the rest of the line
// Add the operators to the selector, don´t pay attention to the IDs
opSelectorP->addOp( *op, rate );
// Keep it in the store, to destroy later
tmpPVec.push_back( op );
} // if
} // while
std::string opSelName;
_is >> opSelName;
eoOpSelector<eoClass>* opSelectorP;
// Build the operator selector
if ( opSelName == "eoProportionalOpSel" ) {
opSelectorP = new eoProportionalOpSel<eoClass>();
}
// Put it in the map
allocMap.insert( MEV::value_type( opSelectorP, tmpPVec ) );
return opSelectorP;
};
// Temp std::vector for storing pointers
vOpP tmpPVec;
// read operator rate and name
while ( _is ) {
float rate;
_is >> rate;
if ( _is ) {
eoOp<eoClass>* op = operatorFactory.make( _is ); // This reads the rest of the line
// Add the operators to the selector, don´t pay attention to the IDs
opSelectorP->addOp( *op, rate );
// Keep it in the store, to destroy later
tmpPVec.push_back( op );
} // if
} // while
///@name eoObject methods
//@{
/** Return the class id */
virtual std::string className() const { return "eoOpSelMason"; }
// Put it in the map
allocMap.insert( MEV::value_type( opSelectorP, tmpPVec ) );
return opSelectorP;
};
///@name eoObject methods
//@{
/** Return the class id */
virtual std::string className() const { return "eoOpSelMason"; }
//@}
//@}
private:
map<eoOpSelector<eoClass>*,std::vector<eoOp<eoClass>* > > allocMap;
eoOpFactory<eoClass>& operatorFactory;
map<eoOpSelector<eoClass>*,std::vector<eoOp<eoClass>* > > allocMap;
eoOpFactory<eoClass>& operatorFactory;
};