[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Base md5.h, 1.1, 1.2 Result.h, 1.2, 1.3 Thread
Brought to you by:
xfred
|
From: Frederic T. <xf...@us...> - 2007-09-04 17:06:22
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17087 Modified Files: md5.h Result.h Thread.h Log Message: For SF's TID #141819 : documenting (Doxygen). Index: Thread.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Thread.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Thread.h 4 Sep 2007 16:56:23 -0000 1.3 --- Thread.h 4 Sep 2007 17:06:15 -0000 1.4 *************** *** 39,43 **** }; ! /** \brief Class for managing threads. * * Uses pthread's threads. --- 39,43 ---- }; ! /** \brief Class for spawning and managing a thread. * * Uses pthread's threads. *************** *** 45,66 **** --- 45,102 ---- class Thread { private: + /** Internal thread identifier (pthread). */ pthread_t tid; + /** Internal terminaison status. + * \sa Terminated() */ + int isTerminated; + /** Internal mutex preventing cross accesses to internal variables. */ Mutex mutex; protected: + /** Pick internal mutex. */ virtual void P(void); + /** Restore/release internal mutex. */ virtual void R(void); + /** Waiting for thread to be joined. */ virtual void join(void); public: + /** Constructor. + * \sa routine() + * \sa Start() */ Thread(); + /** Thread's routine. + * + * This abstract method must be overloaded and should defines code that'll have + * to be executed in the separated thread. */ virtual void routine(void) = 0; + + /** Set isTerminated to 1 (yes). + * \sa isTerminated. + */ virtual void terminated(void); + + /** Returns if the thread is terminated. + * \sa terminated + * \sa isTerminated + * \return 1 if thread is terminated, 0 otherwise. + */ virtual int Terminated(void); + /** Thread's progress. + * + * Returns thread progress (as percentage). + * + * \returns 0.0f (has to be modified, on purpose). + */ virtual float Progress(void); + /** Start the thread. + * + * Execute routine() in a separated thread. + * \sa routine() + */ virtual void Start(void); *************** *** 70,84 **** --- 106,134 ---- + /** Basic class for implementing an action. + * + * This class is currently given just for convenience since it just makes + * Progress() a pure virtual method - to not forget overloading it. + */ class ThreadAction : public Thread { private: protected: + /** Constructor */ ThreadAction(); public: + /** Thread's progress. + * + * Overloads to get a float representing advancement percentage + * (from 0 to 100.0). + * + * \return Nothing. Needs overloading. */ virtual float Progress(void) = 0; + /** Destructor */ ~ThreadAction(); }; + /** Returns pointer to current's thread. */ pthread_t currentThread(void); } Index: md5.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/md5.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** md5.h 22 Jan 2007 17:46:28 -0000 1.1 --- md5.h 4 Sep 2007 17:06:15 -0000 1.2 *************** *** 51,55 **** # define md5_INCLUDED ! /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be --- 51,55 ---- # define md5_INCLUDED ! /** * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be *************** *** 59,72 **** * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ ! typedef unsigned char md5_byte_t; /* 8-bit byte */ ! typedef unsigned int md5_word_t; /* 32-bit word */ ! /* Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { ! md5_word_t count[2]; /* message length in bits, lsw first */ ! md5_word_t abcd[4]; /* digest buffer */ ! md5_byte_t buf[64]; /* accumulate block */ } md5_state_t; --- 59,79 ---- * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. + * + * Comments and help from former package : + * + * Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + * + * L. Peter Deutsch + * gh...@al... */ ! typedef unsigned char md5_byte_t; /*<! 8-bit byte */ ! typedef unsigned int md5_word_t; /*<! 32-bit word */ ! /** Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { ! md5_word_t count[2]; /*<! message length in bits, lsw first */ ! md5_word_t abcd[4]; /*<! digest buffer */ ! md5_byte_t buf[64]; /*<! accumulate block */ } md5_state_t; *************** *** 76,86 **** #endif ! /* Initialize the algorithm. */ void md5_init(md5_state_t *pms); ! ! /* Append a string to the message. */ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); ! /* Finish the message and return the digest. */ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); --- 83,93 ---- #endif ! /** Initialize the algorithm. */ void md5_init(md5_state_t *pms); ! ! /** Append a string to the message. */ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); ! /** Finish the message and return the digest. */ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); Index: Result.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Result.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Result.h 23 May 2007 15:28:04 -0000 1.2 --- Result.h 4 Sep 2007 17:06:15 -0000 1.3 *************** *** 12,23 **** namespace CBM { ! /** \brief Class for storing and managing result */ class Result { protected: XMLNode *node; virtual std::string getAttributeStr(std::string _attr); public: Result(std::string _value, std::string _compilationTime, --- 12,36 ---- namespace CBM { ! /** \brief Class for storing and managing benchmark's results */ class Result { protected: + /** Internal XML representation. */ XMLNode *node; + /** Get (XML) attribute for current result. + * + * Internal convenience method to get attribute (value, compilation time, and + * so on) for the result. + * + * \param _attr Attribute's internal name + * \return The attribute's value as an std::string. */ virtual std::string getAttributeStr(std::string _attr); public: + /** Creates a result object. + * + * Constructor mainly builts the associated (internal) XML node with given + * values. + */ Result(std::string _value, std::string _compilationTime, *************** *** 26,40 **** std::string _testOk); Result(XMLNode *_node); virtual std::string Value(void); virtual std::string compilationTime(void); virtual std::string executionTime(void); virtual std::string tested(void); virtual std::string testOk(void); virtual XMLNode *resultNode(void); ! /** Destructor */ virtual ~Result(); }; --- 39,83 ---- std::string _testOk); + /** Create a result object from an XML node. + */ Result(XMLNode *_node); + /** Returns benchmark's value. + * \sa getAttributeStr() + * \return Benchmark's value as an std::string */ virtual std::string Value(void); + + /** Returns package's compilation time. + * \sa getAttributeStr() + * \return Compilation time (in ms) as an std::string */ virtual std::string compilationTime(void); + + /** Returns package's execution time. + * \sa getAttributeStr() + * \return Execution time (in ms) as an std::string */ virtual std::string executionTime(void); + + /** Returns if the package has to be tested or not. + * \sa getAttributeStr() + * \return A "1" std::string if the package has to be tested, "0" otherwise. */ virtual std::string tested(void); + + /** Returns if the package has been tested or not. + * \sa getAttributeStr() + * \return A "1" std::string if the package has been tested, "0" otherwise. */ virtual std::string testOk(void); + /** Returns XML node. + * + * Give internal XML representation of the result. + * \return Result's XMLNode. + * \sa node + */ virtual XMLNode *resultNode(void); ! /** Destructor ! * ! * Destroys node. ! * \sa node */ virtual ~Result(); }; |