00001 /******************************************************************************* 00002 * SequenceNumber.cpp 00003 * 00004 * (C) 2006 AG Aktives Sehen <agas@uni-koblenz.de> 00005 * Universitaet Koblenz-Landau 00006 * 00007 * Information on Code Review state: 00008 * §Author: R5; DevelTest: Date; Reviewer: R5; Review: Date; State: OK§ 00009 * 00010 * Additional information: 00011 * $Id: SequenceNumber.cpp 44313 2011-04-06 22:46:28Z agas $ 00012 ******************************************************************************/ 00013 00014 #include "SequenceNumber.h" 00015 00016 SequenceNumber* SequenceNumber::instance = 0; 00017 00018 SequenceNumber* SequenceNumber::getInstance() 00019 { 00020 if ( instance == 0 ) 00021 { 00022 instance = new SequenceNumber(); 00023 } 00024 return instance; 00025 } 00026 00027 SequenceNumber::SequenceNumber() 00028 { 00029 m_NextValue = 0; 00030 } 00031 00032 unsigned long SequenceNumber::getSequenceNumber() 00033 { 00034 m_NextValueMutex.lock(); 00035 m_NextValue++; 00036 m_NextValueMutex.unlock(); 00037 return m_NextValue; 00038 } 00039 00040 00041 SequenceNumber::~SequenceNumber() 00042 {} 00043 00044 #ifdef __TEST__ 00045 00046 #include <iostream> 00047 00048 int main ( int argc, char **argv ) 00049 { 00050 std::cout << "UNITTEST" << std::endl; 00051 00052 return 0; 00053 } 00054 #endif 00055