Commit 6db2f221 authored by Pavel Vainerman's avatar Pavel Vainerman

Небольшие правки

parent 38e1bab1
......@@ -133,7 +133,7 @@ class IOController:
{
return ioList.end();
}
inline IOStateList::iterator find(UniSetTypes::KeyType k)
inline IOStateList::iterator find( UniSetTypes::ObjectId k )
{
return ioList.find(k);
}
......
......@@ -268,7 +268,7 @@ class IONotifyController:
};
/*! словарь: аналоговый датчик --> список порогов по нему */
typedef std::unordered_map<UniSetTypes::KeyType, ThresholdsListInfo> AskThresholdMap;
typedef std::unordered_map<UniSetTypes::ObjectId, ThresholdsListInfo> AskThresholdMap;
protected:
IONotifyController();
......
......@@ -88,7 +88,7 @@ class NCRestorer
ic->ioRegistration(inf, force);
}
static inline IOController::IOStateList::iterator ioFind( IONotifyController* ic, UniSetTypes::KeyType k )
static inline IOController::IOStateList::iterator ioFind( IONotifyController* ic, UniSetTypes::ObjectId k )
{
return ic->myiofind(k);
}
......
......@@ -253,7 +253,7 @@ class UInterface
~CacheOfResolve() {};
UniSetTypes::ObjectPtr resolve( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const throw(UniSetTypes::NameNotFound);
void cache( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node, UniSetTypes::ObjectVar ptr ) const;
void cache(const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node, UniSetTypes::ObjectVar& ptr ) const;
void erase( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node ) const;
inline void setMaxSize( size_t ms )
......@@ -273,21 +273,21 @@ class UInterface
mcache.clear();
};
struct Info
struct Item
{
Info( const UniSetTypes::ObjectVar& ptr ): ptr(ptr), ncall(0) {}
Info(): ptr(NULL), ncall(0) {}
Item( const UniSetTypes::ObjectVar& ptr ): ptr(ptr), ncall(0) {}
Item(): ptr(NULL), ncall(0) {}
UniSetTypes::ObjectVar ptr;
size_t ncall; // счётчик обращений
bool operator<( const CacheOfResolve::Info& rhs ) const
bool operator<( const CacheOfResolve::Item& rhs ) const
{
return this->ncall > rhs.ncall;
}
};
typedef std::unordered_map<int, Info> CacheMap;
typedef std::unordered_map<UniSetTypes::KeyType, Item> CacheMap;
mutable CacheMap mcache;
mutable UniSetTypes::uniset_rwmutex cmutex;
size_t MaxSize; /*!< максимальный размер кэша */
......@@ -295,6 +295,7 @@ class UInterface
};
void initBackId( UniSetTypes::ObjectId backid );
protected:
std::string set_err(const std::string& pre, const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node) const;
......
......@@ -1128,7 +1128,7 @@ throw(NameNotFound)
throw UniSetTypes::NameNotFound();
}
// ------------------------------------------------------------------------------------------------------------
void UInterface::CacheOfResolve::cache( const ObjectId id, const ObjectId node, ObjectVar ptr ) const
void UInterface::CacheOfResolve::cache( const ObjectId id, const ObjectId node, ObjectVar& ptr ) const
{
UniSetTypes::uniset_rwmutex_wrlock l(cmutex);
......@@ -1137,7 +1137,7 @@ void UInterface::CacheOfResolve::cache( const ObjectId id, const ObjectId node,
auto it = mcache.find(k);
if( it == mcache.end() )
mcache.emplace(k, Info(ptr));
mcache.emplace(k, Item(ptr));
else
{
it->second.ptr = ptr; // CORBA::Object::_duplicate(ptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment