整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
77
video/core/SerialCode.h
Normal file
77
video/core/SerialCode.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#ifndef F54A2617_3BA7_4779_88A5_AB040FD9B002
|
||||
#define F54A2617_3BA7_4779_88A5_AB040FD9B002
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INCLUDE
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include "CodecID.h"
|
||||
#include <Poco/Nullable.h>
|
||||
#include <Poco/Any.h>
|
||||
#include <map>
|
||||
|
||||
namespace Video
|
||||
{
|
||||
namespace Core
|
||||
{
|
||||
/*
|
||||
*******************************************************************************
|
||||
* CLASS DECLARE
|
||||
*******************************************************************************
|
||||
*/
|
||||
class SerialCode
|
||||
{
|
||||
public:
|
||||
bool empty() const;
|
||||
void reset();
|
||||
const SerialCode& operator++();
|
||||
const SerialCode& operator++(int);
|
||||
bool operator!=(const SerialCode& other);
|
||||
const SerialCode& operator=(const SerialCode& other);
|
||||
const SerialCode& operator=(const uint32_t other);
|
||||
|
||||
private:
|
||||
Poco::Nullable<uint32_t> _value;
|
||||
};
|
||||
|
||||
class SerialCodeManager
|
||||
{
|
||||
public:
|
||||
SerialCodeManager();
|
||||
|
||||
template <class T> void put(const std::string& name, const T& value);
|
||||
void increment();
|
||||
|
||||
const SerialCode& code() const;
|
||||
|
||||
private:
|
||||
SerialCode _code;
|
||||
std::map<std::string, Poco::Any> _values;
|
||||
};
|
||||
|
||||
template <class T> inline void SerialCodeManager::put(const std::string& name, const T& value)
|
||||
{
|
||||
if (_values.find(name) == _values.end() || Poco::AnyCast<T>(_values[name]) != value)
|
||||
{
|
||||
_values[name] = value;
|
||||
_code++;
|
||||
}
|
||||
}
|
||||
|
||||
inline const SerialCode& SerialCodeManager::code() const
|
||||
{
|
||||
return _code;
|
||||
}
|
||||
|
||||
class SerialCodeWatcher
|
||||
{
|
||||
public:
|
||||
bool isChanged(const SerialCode& code, bool firstAsChanged = false);
|
||||
void reset();
|
||||
|
||||
private:
|
||||
SerialCode _code;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue