From: jean-pierre roux Date: Mon, 8 Feb 2010 15:24:05 +0000 (+0000) Subject: reindent X-Git-Tag: CREATOOLS.2-0-3~1 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2f2e2e1951622df36eeed906d83256ae1304d2be;p=creaEnvironment.git reindent --- diff --git a/lib/kernel_Environment/ConceptInstantHandler.cxx b/lib/kernel_Environment/ConceptInstantHandler.cxx index 91f5fa7..61fd0b6 100644 --- a/lib/kernel_Environment/ConceptInstantHandler.cxx +++ b/lib/kernel_Environment/ConceptInstantHandler.cxx @@ -1,4 +1,4 @@ - + // SYSTEM INCLUDES #include @@ -16,289 +16,285 @@ // FORWARD REFERENCES - + - - //====== LIFECYCLE ======== - ConceptInstantHandler::ConceptInstantHandler(std::string name,int mode,int positionInReproduction) - { - this->name=name; - this->mode=mode; - this->positionInReproduction=positionInReproduction; - this->increaseValue=1; - this->decreaseValue=1; - this->actualIndex=0; - this->scaleTime=0; - //timeReproduction=intervalTimer*maximumValue - this->timeReproduction=100; - this->actualTime=0; - this->initialTime=0; - } - ConceptInstantHandler::~ConceptInstantHandler() - { - name.clear(); - } - //====== OPERATIONS ======= - /* - * change the actual index by increasing - * the index until the maximum by the increaseValue - */ - void ConceptInstantHandler::nextIndex() - { - - //just plus plus - if(mode==PLUS_PLUS) - actualIndex+=increaseValue; - //time scale - else - { - time_t seconds=time(NULL); - if(initialTime==0) - initialTime=seconds*1000; - int time=seconds*1000; - actualTime=time-initialTime; - actualIndex=(int)actualTime*scaleTime; - } - + + //====== LIFECYCLE ======== + ConceptInstantHandler::ConceptInstantHandler(std::string name,int mode,int positionInReproduction) + { + this->name=name; + this->mode=mode; + this->positionInReproduction=positionInReproduction; + this->increaseValue=1; + this->decreaseValue=1; + this->actualIndex=0; + this->scaleTime=0; + //timeReproduction=intervalTimer*maximumValue + this->timeReproduction=100; + this->actualTime=0; + this->initialTime=0; + } + + ConceptInstantHandler::~ConceptInstantHandler() + { + name.clear(); + } + //====== OPERATIONS ======= + /* + * change the actual index by increasing + * the index until the maximum by the increaseValue + */ + void ConceptInstantHandler::nextIndex() + { + + //just plus plus + if(mode==PLUS_PLUS) + actualIndex+=increaseValue; + //time scale + else + { + time_t seconds=time(NULL); + if(initialTime==0) + initialTime=seconds*1000; + int time=seconds*1000; + actualTime=time-initialTime; + actualIndex=(int)actualTime*scaleTime; + } + - if(actualIndex>=maximumIndex) - actualIndex=maximumIndex-1; - - - } - /* - * change the actual index by decreasing - * the index until zero by the decreaseValue - */ - void ConceptInstantHandler::previousIndex() - { - //just plus plus - if(mode==PLUS_PLUS) - actualIndex-=decreaseValue; - - else - actualIndex=(int)actualTime*scaleTime; - - if(actualIndex<0) - actualIndex=0; - - } - - //====== INQUIRY ========= - /* - * @return name - */ - std::string ConceptInstantHandler::getName() - { - return this->name; - } - /* - * @return PositionInReproduction - */ - int ConceptInstantHandler::getPosition() - { - return this->positionInReproduction; - } - /* - * @return mode - */ - int ConceptInstantHandler::getMode() - { - return this->mode; - } - /* - * @return increaseValue - */ - int ConceptInstantHandler::getIncreaseValue() - { - return this->increaseValue; - } - - /* - * @return decreaseValue - */ - int ConceptInstantHandler::getDecreaseValue() - { - return this->decreaseValue; - } - - /* - * @return indexInInstant - */ - int ConceptInstantHandler::getIndexInInstant() - { - return this->indexInInstant; - } - /* - * @return actualIndex - */ - int ConceptInstantHandler::geActualIndex() - { - return actualIndex; - } - /* - * @return maximumIndex - */ - - int ConceptInstantHandler::getMaximumIndex() - { - return maximumIndex; - } - /* - * @return timeReproduction - */ - double ConceptInstantHandler::getTimeReproduction() - { - return timeReproduction; - } - /* - * @return scaleTime - */ - double ConceptInstantHandler::getScale() - { - return scaleTime; - } - /* - * if the actual index is not the maximum index - */ - bool ConceptInstantHandler::hasNextIndex() - { - if(actualIndex0) - return true; - else return false; - } - /* - * Get initial time - */ - double ConceptInstantHandler::getInitialTime() - { - return this->initialTime; - } + if(actualIndex>=maximumIndex) + actualIndex=maximumIndex-1; + } + /* + * change the actual index by decreasing + * the index until zero by the decreaseValue + */ + void ConceptInstantHandler::previousIndex() + { + //just plus plus + if(mode==PLUS_PLUS) + actualIndex-=decreaseValue; + + else + actualIndex=(int)actualTime*scaleTime; + + if(actualIndex<0) + actualIndex=0; + + } + + //====== INQUIRY ========= + /* + * @return name + */ + std::string ConceptInstantHandler::getName() + { + return this->name; + } + /* + * @return PositionInReproduction + */ + int ConceptInstantHandler::getPosition() + { + return this->positionInReproduction; + } + /* + * @return mode + */ + int ConceptInstantHandler::getMode() + { + return this->mode; + } + /* + * @return increaseValue + */ + int ConceptInstantHandler::getIncreaseValue() + { + return this->increaseValue; + } + + /* + * @return decreaseValue + */ + int ConceptInstantHandler::getDecreaseValue() + { + return this->decreaseValue; + } + + /* + * @return indexInInstant + */ + int ConceptInstantHandler::getIndexInInstant() + { + return this->indexInInstant; + } + /* + * @return actualIndex + */ + int ConceptInstantHandler::geActualIndex() + { + return actualIndex; + } + /* + * @return maximumIndex + */ + + int ConceptInstantHandler::getMaximumIndex() + { + return maximumIndex; + } + /* + * @return timeReproduction + */ + double ConceptInstantHandler::getTimeReproduction() + { + return timeReproduction; + } + /* + * @return scaleTime + */ + double ConceptInstantHandler::getScale() + { + return scaleTime; + } + /* + * if the actual index is not the maximum index + */ + bool ConceptInstantHandler::hasNextIndex() + { + if(actualIndex0) + return true; + else return false; + } + /* + * Get initial time + */ + double ConceptInstantHandler::getInitialTime() + { + return this->initialTime; + } - //====== ACCESS ========== - /* - * Sets the name of the concept - * @param name, new name - */ - void ConceptInstantHandler::setName(std::string name) - { - this->name=name; - } - /* - * Sets the position of the concept - * @param position, position - */ - void ConceptInstantHandler::setPosition(int position) - { - this->positionInReproduction=position; - } - /* - * Sets the mode of the concept - * @param mode, new mode= REAL_TIME or - * PLUS_PLUS - */ - void ConceptInstantHandler::setMode(int mode) - { - if(this->mode==PLUS_PLUS) - { - time_t seconds=time(NULL); - int time=seconds*1000; - actualTime=actualIndex/scaleTime; - initialTime=time-actualTime; - } - this->mode=mode; - } - /* - * Set Increase of the instant - */ - void ConceptInstantHandler::setIncreaseValue(int increaseValue) - { - this->increaseValue=increaseValue; - } + //====== ACCESS ========== + /* + * Sets the name of the concept + * @param name, new name + */ + void ConceptInstantHandler::setName(std::string name) + { + this->name=name; + } + /* + * Sets the position of the concept + * @param position, position + */ + void ConceptInstantHandler::setPosition(int position) + { + this->positionInReproduction=position; + } + /* + * Sets the mode of the concept + * @param mode, new mode= REAL_TIME or + * PLUS_PLUS + */ + void ConceptInstantHandler::setMode(int mode) + { + if(this->mode==PLUS_PLUS) + { + time_t seconds=time(NULL); + int time=seconds*1000; + actualTime=actualIndex/scaleTime; + initialTime=time-actualTime; + } + this->mode=mode; + } + /* + * Set Increase of the instant + */ + void ConceptInstantHandler::setIncreaseValue(int increaseValue) + { + this->increaseValue=increaseValue; + } - /* - * Set decrease of the instant - */ - void ConceptInstantHandler::setDecreaseValue(int decreaseValue) - { - this->decreaseValue=decreaseValue; - } - /* - * Sets the index of the concept in the instant - * @param indexInInstant - */ - void ConceptInstantHandler::setIndexInInstant(int indexInInstant) - { - this->indexInInstant=indexInInstant; - } - /* - * Sets sets the maximum value - * @param maximumIndex - */ - void ConceptInstantHandler::setMaximumIndex(int maximumIndex) - { - this->maximumIndex=maximumIndex; - scaleTime=(maximumIndex-1)/timeReproduction; - } + /* + * Set decrease of the instant + */ + void ConceptInstantHandler::setDecreaseValue(int decreaseValue) + { + this->decreaseValue=decreaseValue; + } + /* + * Sets the index of the concept in the instant + * @param indexInInstant + */ + void ConceptInstantHandler::setIndexInInstant(int indexInInstant) + { + this->indexInInstant=indexInInstant; + } + /* + * Sets sets the maximum value + * @param maximumIndex + */ + void ConceptInstantHandler::setMaximumIndex(int maximumIndex) + { + this->maximumIndex=maximumIndex; + scaleTime=(maximumIndex-1)/timeReproduction; + } - /* - * set the actualIndex - */ - void ConceptInstantHandler::setActualIndex(int index) - { - if(index<=maximumIndex-1) - actualIndex=index; - //TODO else thow exception of out of bounds - } - /* - * set the timeReproduction - * @param timeReproduction - */ - void ConceptInstantHandler::setTimeReproduction(double time) - { - this->timeReproduction=(this->maximumIndex-1)*time; - scaleTime=(maximumIndex-1)/timeReproduction; - } - /* - * set the scaleTime - * @param scale - */ - void ConceptInstantHandler::setScale(double scale) - { - this->scaleTime=scale; - } - /* - * set the actualTime - * @param actualTime - */ - void ConceptInstantHandler::setActualTime(double actualTime) - { - this->actualTime=actualTime; - } - /* - * reset the initial time - */ - void ConceptInstantHandler::resetInitialTime() - { - this->initialTime=0; - } - /* - * Sets the initial time - */ - void ConceptInstantHandler::setInitialTime(double time) - { - this->initialTime=time; - } + /* + * set the actualIndex + */ + void ConceptInstantHandler::setActualIndex(int index) + { + if(index<=maximumIndex-1) + actualIndex=index; + //TODO else thow exception of out of bounds + } + /* + * set the timeReproduction + * @param timeReproduction + */ + void ConceptInstantHandler::setTimeReproduction(double time) + { + this->timeReproduction=(this->maximumIndex-1)*time; + scaleTime=(maximumIndex-1)/timeReproduction; + } + /* + * set the scaleTime + * @param scale + */ + void ConceptInstantHandler::setScale(double scale) + { + this->scaleTime=scale; + } + /* + * set the actualTime + * @param actualTime + */ + void ConceptInstantHandler::setActualTime(double actualTime) + { + this->actualTime=actualTime; + } + /* + * reset the initial time + */ + void ConceptInstantHandler::resetInitialTime() + { + this->initialTime=0; + } + /* + * Sets the initial time + */ + void ConceptInstantHandler::setInitialTime(double time) + { + this->initialTime=time; + } - - - diff --git a/lib/kernel_Environment/ConceptInstantHandler.h b/lib/kernel_Environment/ConceptInstantHandler.h index 8c323cf..6636eb1 100644 --- a/lib/kernel_Environment/ConceptInstantHandler.h +++ b/lib/kernel_Environment/ConceptInstantHandler.h @@ -3,10 +3,10 @@ Program: ConceptInstantHandler Module: $RCSfile: ConceptInstantHandler.h,v $ Language: C++ - Date: $Date: 2008/11/24 10:23:53 $ - Version: $Revision: 1.6 $ + Date: $Date: 2010/02/08 15:24:05 $ + Version: $Revision: 1.7 $ Objective: Wrapper fo the concepts that subscribe to the instant handler - Authot: Monica Maria Lozano Romero + Author: Monica Maria Lozano Romero Copyright: (c) 2007 License: @@ -26,18 +26,14 @@ // PROJECT INCLUDES - - // LOCAL INCLUDES // FORWARD REFERENCES - - /* -* COMMENT -* @param -* @return +* COMMENT +* @param +* @return */ @@ -46,243 +42,240 @@ #if defined(_WIN32) - #ifdef creaEnvironment_BUILD_SHARED - #define creaEnvironment_EXPORTS __declspec( dllexport ) - #else - #define creaEnvironment_EXPORTS - #endif + #ifdef creaEnvironment_BUILD_SHARED + #define creaEnvironment_EXPORTS __declspec( dllexport ) + #else + #define creaEnvironment_EXPORTS + #endif #else - #define creaEnvironment_EXPORTS + #define creaEnvironment_EXPORTS #endif class creaEnvironment_EXPORTS ConceptInstantHandler - { - public: - //===== CONSTANTS ======== - /* - * if the concept is being reproduced in real time - */ - const static int REAL_TIME=1; - /* - * if the concept is being reproduced by doing - * plus plus to its indexes - */ - const static int PLUS_PLUS=2; - - - //====== LIFECYCLE ======== - ConceptInstantHandler(std::string name,int mode,int positionInReproduction); - ~ConceptInstantHandler(); - //====== OPERATIONS ======= - /* - * change the actual index by increasing - * the index until the maximum by the increaseValue - */ - void nextIndex(); - /* - * change the actual index by decreasing - * the index until zero by the decreaseValue - */ - void previousIndex(); - - - //====== INQUIRY ========= - /* - * @return name - */ - std::string getName(); - /* - * @return PositionInReproduction - */ - int getPosition(); - /* - * @return mode - */ - int getMode(); - /* - * @return increaseValue - */ - int getIncreaseValue(); - - /* - * @return decreaseValue - */ - int getDecreaseValue(); - - /* - * @return indexInInstant - */ - int getIndexInInstant(); - /* - * @return actualIndex - */ - int geActualIndex(); - /* - * @return maximumIndex - */ - - int getMaximumIndex(); - /* - * @return timeReproduction - */ - double getTimeReproduction(); - /* - * @return scaleTime - */ - double getScale(); - - /* - * if the actual index is not the maximum index - */ - bool hasNextIndex(); - /* - * if the actual index is not zero - */ - bool hasPreviousIndex(); - - /* - * Get initial time - */ - double getInitialTime(); - - - //====== ACCESS ========== - /* - * Sets the name of the concept - * @param name, new name - */ - void setName(std::string name); - /* - * Sets the position of the concept - * @param position - */ - void setPosition(int position); - /* - * Sets the mode of the concept - * @param mode, new mode= REAL_TIME or - * PLUS_PLUS - */ - void setMode(int mode); - /* - * Set Increase of the concept - * @param increaseValue - */ - void setIncreaseValue(int increaseValue); - - /* - * Set decrease of the concept - * @param decreaseValue - */ - void setDecreaseValue(int decreaseValue); - - /* - * Sets the index of the concept in the instant - * @param indexInInstant - */ - void setIndexInInstant(int indexInInstant); - /* - * Sets sets the maximum value - * @param maximumIndex - */ - void setMaximumIndex(int maximumIndex); - /* - * set the actualIndex - * @param index - */ - void setActualIndex(int index); - /* - * set the timeReproduction - * @param time - */ - void setTimeReproduction(double time); - /* - * set the scaleTime - * @param scale - */ - void setScale(double scale); - /* - * set the actualTime - * @param actualTime - */ - void setActualTime(double actualTime); - /* - * reset the initial time - */ - void resetInitialTime(); - /* - * Sets the initial time - */ - void setInitialTime(double time); - - - private: - - //======= ATTRIBUTES======= - - /* - * Name of the concept - */ - std::string name; - /* - * Mode of changing the instant - * REAL_TIME - * PLUS_PLUS - */ - int mode; - - /* - * position in the reproduction - */ - int positionInReproduction; - /* - * Increment for an instant - * for default is 1 - */ - int increaseValue; - /* - * Decrease for an instant - * for default is 1 - */ - int decreaseValue; - /* - * index in Instant - */ - int indexInInstant; - /* - * index that it is - */ - int actualIndex; - /* - * maximum index that can have in the instant - */ - int maximumIndex; - /* - * Time in miliseconds of the reproduction - */ - double timeReproduction; - /* - * Scale use for calculate the index - * of the concept according to the time of reproduction - * defined in timeReproduction - * scaleTime=maximumIndex/timeReproduction - */ - double scaleTime; - /* - * actual time of the reproduction - * is in miliseconds - */ - double actualTime; - /* - * Initial time - * is in miliseconds - */ - double initialTime; - - - - //====== PRIVATE METHODS========= - - - }; +{ +public: + //===== CONSTANTS ======== + /* + * if the concept is being reproduced in real time + */ + const static int REAL_TIME=1; + /* + * if the concept is being reproduced by doing + * plus plus to its indexes + */ + const static int PLUS_PLUS=2; + + + //====== LIFECYCLE ======== + ConceptInstantHandler(std::string name,int mode,int positionInReproduction); + ~ConceptInstantHandler(); + //====== OPERATIONS ======= + /* + * change the actual index by increasing + * the index until the maximum by the increaseValue + */ + void nextIndex(); + /* + * change the actual index by decreasing + * the index until zero by the decreaseValue + */ + void previousIndex(); + + //====== INQUIRY ========= + /* + * @return name + */ + std::string getName(); + /* + * @return PositionInReproduction + */ + int getPosition(); + /* + * @return mode + */ + int getMode(); + /* + * @return increaseValue + */ + int getIncreaseValue(); + + /* + * @return decreaseValue + */ + int getDecreaseValue(); + + /* + * @return indexInInstant + */ + int getIndexInInstant(); + /* + * @return actualIndex +*/ + int geActualIndex(); + /* + * @return maximumIndex + */ + + int getMaximumIndex(); + /* + * @return timeReproduction + */ + double getTimeReproduction(); + /* + * @return scaleTime + */ + double getScale(); + + /* + * if the actual index is not the maximum index + */ + bool hasNextIndex(); + /* + * if the actual index is not zero + */ + bool hasPreviousIndex(); + + /* + * Get initial time + */ + double getInitialTime(); + + + //====== ACCESS ========== + /* + * Sets the name of the concept + * @param name, new name + */ + void setName(std::string name); + /* + * Sets the position of the concept + * @param position + */ + void setPosition(int position); + /* + * Sets the mode of the concept + * @param mode, new mode= REAL_TIME or + * PLUS_PLUS + */ + void setMode(int mode); + /* + * Set Increase of the concept + * @param increaseValue + */ + void setIncreaseValue(int increaseValue); + + /* + * Set decrease of the concept + * @param decreaseValue + */ + void setDecreaseValue(int decreaseValue); + + /* + * Sets the index of the concept in the instant + * @param indexInInstant + */ + void setIndexInInstant(int indexInInstant); + /* + * Sets sets the maximum value + * @param maximumIndex + */ + void setMaximumIndex(int maximumIndex); + /* + * set the actualIndex + * @param index + */ + void setActualIndex(int index); + /* + * set the timeReproduction + * @param time + */ + void setTimeReproduction(double time); + /* + * set the scaleTime + * @param scale + */ + void setScale(double scale); + /* + * set the actualTime + * @param actualTime + */ + void setActualTime(double actualTime); + /* + * reset the initial time + */ + void resetInitialTime(); + /* + * Sets the initial time + */ + void setInitialTime(double time); + + + private: + + //======= ATTRIBUTES======= + + /* + * Name of the concept + */ + std::string name; + /* + * Mode of changing the instant + * REAL_TIME + * PLUS_PLUS + */ + int mode; + + /* + * position in the reproduction + */ + int positionInReproduction; + /* + * Increment for an instant + * for default is 1 + */ + int increaseValue; + /* + * Decrease for an instant + * for default is 1 + */ + int decreaseValue; + /* + * index in Instant + */ + int indexInInstant; + /* + * index that it is + */ + int actualIndex; + /* + * maximum index that can have in the instant + */ + int maximumIndex; + /* + * Time in miliseconds of the reproduction + */ + double timeReproduction; + /* + * Scale use for calculate the index + * of the concept according to the time of reproduction + * defined in timeReproduction + * scaleTime=maximumIndex/timeReproduction + */ + double scaleTime; + /* + * actual time of the reproduction + * is in miliseconds + */ + double actualTime; + /* + * Initial time + * is in miliseconds + */ + double initialTime; + + //====== PRIVATE METHODS========= + + + }; #endif