Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7331 in orxonox.OLD


Ignore:
Timestamp:
Apr 18, 2006, 4:48:37 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: small improved functoid

Location:
trunk/src/lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.cc

    r7320 r7331  
    184184            {
    185185
    186               (*alias)->getCommand()->executor->execute(objectList->front(), inputSplits.getSubSet(1).join()); /// TODO CHECK IF OK
     186              (*(*alias)->getCommand()->executor)(objectList->front(), inputSplits.getSubSet(1).join()); /// TODO CHECK IF OK
    187187            }
    188188            else
    189               (*alias)->getCommand()->executor->execute(objectList->front(), "");
     189              (*(*alias)->getCommand()->executor)(objectList->front(), "");
    190190           return true;
    191191          }
     
    241241              return false;
    242242            if (inputSplits.size() > fktPos+1)
    243               (*cmdIT)->executor->execute(objectPointer, inputSplits.getSubSet(2).join()); /// TODO CHECK IF OK
     243              (*(*cmdIT)->executor)(objectPointer, inputSplits.getSubSet(2).join()); /// TODO CHECK IF OK
    244244            else
    245               (*cmdIT)->executor->execute(objectPointer, "");
     245              (*(*cmdIT)->executor)(objectPointer, "");
    246246            return true;
    247247          }
  • trunk/src/lib/sound/ogg_player.h

    r7329 r7331  
    8989  SDL_Thread*         musicThreadID;        //!< The Thread in which music is Played back.
    9090  SDL_mutex*          musicMutex;           //!< A Mutex so that the two threads do not interfere.
    91 
    92   class MutexLock
    93   {
    94   public:
    95     MutexLock(SDL_mutex* mutex) { SDL_mutexP(mutex); this->mutex = mutex; };
    96     ~MutexLock() { SDL_mutexV(mutex); };
    97   private:
    98     SDL_mutex* mutex;
    99   };
    10091};
    10192
  • trunk/src/lib/util/executor/executor.h

    r7300 r7331  
    3434 *  Default Values
    3535 *  Functions with up to 5 parameters (more seems useless)
    36  *  Functions with many types (see functor_list.h)
     36 *  Functions with many types (@see functor_list.h)
    3737 */
    3838class Executor: public BaseObject
     
    4343    virtual Executor* clone () const = 0;
    4444
     45    // SETTING up the EXECUTOR
    4546    Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL,
    4647                            const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL,
    4748                            const MultiType& value4 = MT_NULL);
    4849
     50    // EXECUTE
    4951    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
    50     virtual void execute (BaseObject* object, const std::string& parameters = "") = 0;
    51 
     52    virtual void operator()(BaseObject* object, const std::string& parameters = "") = 0;
     53    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes @brief here for your convenience*/
     54    void execute (BaseObject* object, const std::string& parameters = "") { (*this)(object, parameters); };
     55
     56    // RETRIEVE INFORMATION
    5257    /** @returns the Type of this Function (either static or objective) */
    5358    inline long getType() const { return this->functorType; };
     
    6570
    6671  protected:
    67     long                        functorType;      //!< The type of Function we've got (either static or objective).
     72    short                       functorType;      //!< The type of Function we've got (either static or objective).
    6873    unsigned int                paramCount;       //!< the count of parameters.
    6974    MultiType                   defaultValue[5];  //!< Default Values.
     
    7277///////////////////////////////////////////////////
    7378///////////////////////////////////////////////////
    74 
    75 /////////////////////////////////
    76 // MACRO DEFINITION EXTENSIONS //
    77 /////////////////////////////////
    78 //! where to chek for default BOOL values
    79 #define   l_BOOL_DEFGRAB(i)         this->defaultValue[i].getBool()
    80 //! where to chek for default INT values
    81 #define   l_INT_DEFGRAB(i)          this->defaultValue[i].getInt()
    82 //! where to chek for default UINT values
    83 #define   l_UINT_DEFGRAB(i)         (unsigned int)this->defaultValue[i].getInt()
    84 //! where to chek for default LONG values
    85 #define   l_LONG_DEFGRAB(i)         (long)this->defaultValue[i].getInt()
    86 //! where to chek for default FLOAT values
    87 #define   l_FLOAT_DEFGRAB(i)        this->defaultValue[i].getFloat()
    88 //! where to chek for default STRING values
    89 #define   l_STRING_DEFGRAB(i)       this->defaultValue[i].getString()
    90 //! where to chek for default CSTRING values
    91 #define   l_CSTRING_DEFGRAB(i)      this->defaultValue[i].getCString()
    9279
    9380//////////////////////////
     
    267254    } fp;
    268255
    269     virtual void execute (BaseObject* object, const std::string& parameters = "")
     256    virtual void operator()(BaseObject* object, const std::string& parameters = "")
    270257    {
    271258      SubString sub;
     
    330317
    331318
    332     virtual void execute (BaseObject* object, const std::string& parameters = "")
     319    virtual void operator()(BaseObject* object, const std::string& parameters = "")
    333320    {
    334321      SubString sub;
  • trunk/src/lib/util/executor/executor_specials.h

    r7221 r7331  
    2323  public:
    2424    /**
    25      * Constructor of a ExecutorXML
     25   * @brief Constructor of a ExecutorXML
    2626     * @param function a Function to call
    2727     * @param root The XML root to search paramName under
     
    4343
    4444    /**
    45      * clones an ExecutorXML, used to copy this Element.
     45     * @brief clones an ExecutorXML, used to copy this Element.
    4646     * @returns a _new_ Copy of this Executor
    4747     */
     
    5656
    5757    /**
    58      * executes the Command on BaseObject
     58     * @brief executes the Command on BaseObject
    5959     * @param object the BaseObject to execute this Executor on
    6060     * @param loadString ignored in this case
    6161     */
    62     virtual void execute(BaseObject* object, const std::string& = "")
     62    virtual void operator()(BaseObject* object, const std::string& = "")
    6363    {
    6464      if (object != NULL && this->element != NULL)
     
    6868  private:
    6969    /**
    70      * used for the copy-(Clone)-constructor
     70   * @brief used for the copy-(Clone)-constructor
    7171     */
    7272    ExecutorXML() : Executor() { };
  • trunk/src/lib/util/executor/functor_list.h

    r7221 r7331  
    3232#include "multi_type.h"
    3333
     34
    3435#define l_BOOL_TYPE        bool                 //!< The type of an BOOL
    3536#define l_BOOL_FUNC        isBool               //!< The function to call to parse BOOL
    36 #define l_BOOL_NAME        "bool"               //!< The name of an BOOL
    3737#define l_BOOL_PARAM       MT_BOOL              //!< the type of the parameter BOOL
    3838#define l_BOOL_DEFAULT     false                //!< a default Value for an BOOL
    39 
     39#define l_BOOL_DEFGRAB(i)  this->defaultValue[i].getBool()
    4040
    4141#define l_INT_TYPE         int                  //!< The type of an INT
    4242#define l_INT_FUNC         isInt                //!< The function to call to parse INT
    43 #define l_INT_NAME         "int"                //!< The name of an INT
    4443#define l_INT_PARAM        MT_INT               //!< the type of the parameter INT
    4544#define l_INT_DEFAULT      0                    //!< a default Value for an INT
     45#define l_INT_DEFGRAB(i)   this->defaultValue[i].getInt()
    4646
    4747#define l_UINT_TYPE        unsigned int         //!< The type of an UINT
    4848#define l_UINT_FUNC        isInt                //!< The function to call to parse UINT
    49 #define l_UINT_NAME        "unsigned int"       //!< The name of an UINT
    5049#define l_UINT_PARAM       MT_INT        //!< the type of the parameter UINT
    5150#define l_UINT_DEFAULT     0                    //!< a default Value for an UINT
     51#define l_UINT_DEFGRAB(i)  (unsigned int)this->defaultValue[i].getInt()
    5252
    5353#define l_LONG_TYPE        long                 //!< The type of a LONG
    5454#define l_LONG_FUNC        isInt                //!< The function to parse a LONG
    55 #define l_LONG_NAME        "long"               //!< The name of a LONG
    5655#define l_LONG_PARAM       MT_INT //!< the type of the parameter LONG
    5756#define l_LONG_DEFAULT     0                    //!< a default Value for a LONG
     57#define l_LONG_DEFGRAB(i)  (long)this->defaultValue[i].getInt()
    5858
    5959// #define l_SHORT_TYPE       short                //!< The type of a SHORT
     
    6565#define l_FLOAT_TYPE       float                //!< The type of a FLOAT
    6666#define l_FLOAT_FUNC       isFloat              //!< The function to parse a FLOAT
    67 #define l_FLOAT_NAME       "float"              //!< The name of a FLOAT
    6867#define l_FLOAT_PARAM      MT_FLOAT             //!< the type of the parameter FLOAT
    6968#define l_FLOAT_DEFAULT    0.0                  //!< a default Value for a FLOAT
     69#define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat()
    7070
    7171//#define l_VECTOR_TYPE      const Vector&        //!< The type of a VECTOR
     
    7676#define l_STRING_TYPE      const std::string&   //!< The type of a STRING
    7777#define l_STRING_FUNC      isString             //!< The function to parse a STRING
    78 #define l_STRING_NAME      "string"             //!< The name of a STRING
    79 #define l_STRING_PARAM     MT_STRING           //!< the type of the parameter STRING
     78#define l_STRING_PARAM     MT_STRING            //!< the type of the parameter STRING
    8079#define l_STRING_DEFAULT   ""                   //!< a default Value for an STRING
     80#define l_STRING_DEFGRAB(i) this->defaultValue[i].getString()
    8181
    8282#define l_XML_ELEM_TYPE    const TiXmlElement*  //!< The type of an XML_ELEM
    8383#define l_XML_ELEM_FUNC                         //!< The function to parse an XML_ELEM
    84 #define l_XML_ELEM_NAME    "XML"                //!< The name of an XML_ELEM
    8584//#define l_XML_ELEM_PARAM   Parameter            //!< the type of the parameter XML_ELEM
    8685#define l_XML_ELEM_DEFAULT NULL                 //!< The dafault Value for an XML_ELEM
  • trunk/src/lib/util/loading/load_param.cc

    r7221 r7331  
    6767    {
    6868      PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassName(), this->object->getName());
    69       this->executor->execute(this->object, loadString);
     69      (*this->executor)(this->object, loadString);
    7070    }
    7171    delete this->executor;
  • trunk/src/lib/util/threading.h

    r7329 r7331  
    1717
    1818//! A class for Wrapping Threads
    19 class Threading {
     19class Threading
     20{
    2021
    21  public:
     22public:
    2223  Threading();
    2324  virtual ~Threading();
    2425
    2526
    26  private:
     27private:
    2728
    2829};
    2930
     31//! A Class that locks a Mutex within its scope
     32class MutexLock
     33{
     34public:
     35  //! Locks the Mutex mutex in this Scope.
     36  MutexLock(SDL_mutex* mutex) { SDL_mutexP(mutex); this->mutex = mutex; };
     37  ~MutexLock() { SDL_mutexV(mutex); };
     38private:
     39  SDL_mutex* mutex;         //!< The Mutex to lock.
     40};
     41
     42
    3043#endif /* _THREADING_H */
Note: See TracChangeset for help on using the changeset viewer.