My Project
Loading...
Searching...
No Matches
LibThread::TxTable Class Reference

Public Member Functions

 TxTable ()
 
virtual ~TxTable ()
 
int put (string &key, string &value)
 
int get (string &key, string &value)
 
int check (string &key)
 
- Public Member Functions inherited from LibThread::Transactional
 Transactional ()
 
void set_region (Region *region_init)
 
virtual ~Transactional ()
 
- Public Member Functions inherited from LibThread::SharedObject
 SharedObject ()
 
virtual ~SharedObject ()
 
void set_type (int type_init)
 
int get_type ()
 
void set_name (std::string &name_init)
 
void set_name (const char *s)
 
std::string & get_name ()
 
void incref (int by=1)
 
long decref ()
 
long getref ()
 
virtual BOOLEAN op2 (int op, leftv res, leftv a1, leftv a2)
 
virtual BOOLEAN op3 (int op, leftv res, leftv a1, leftv a2, leftv a3)
 

Private Attributes

std::map< string, string > entries
 

Additional Inherited Members

- Protected Member Functions inherited from LibThread::Transactional
int tx_begin ()
 
void tx_end ()
 

Detailed Description

Definition at line 315 of file shared.cc.

Constructor & Destructor Documentation

◆ TxTable()

LibThread::TxTable::TxTable ( )
inline

Definition at line 319 of file shared.cc.

319: Transactional(), entries() { }
std::map< string, string > entries
Definition shared.cc:317

◆ ~TxTable()

virtual LibThread::TxTable::~TxTable ( )
inlinevirtual

Definition at line 320 of file shared.cc.

320{ }

Member Function Documentation

◆ check()

int LibThread::TxTable::check ( string & key)
inline

Definition at line 343 of file shared.cc.

343 {
344 int result;
345 if (!tx_begin()) return -1;
346 result = entries.count(key);
347 tx_end();
348 return result;
349 }
return result

◆ get()

int LibThread::TxTable::get ( string & key,
string & value )
inline

Definition at line 333 of file shared.cc.

333 {
334 int result = 0;
335 if (!tx_begin()) return -1;
336 if (entries.count(key)) {
337 value = entries[key];
338 result = 1;
339 }
340 tx_end();
341 return result;
342 }

◆ put()

int LibThread::TxTable::put ( string & key,
string & value )
inline

Definition at line 321 of file shared.cc.

321 {
322 int result = 0;
323 if (!tx_begin()) return -1;
324 if (entries.count(key)) {
325 entries[key] = value;
326 } else {
327 entries.insert(pair<string, string>(key, value));
328 result = 1;
329 }
330 tx_end();
331 return result;
332 }

Field Documentation

◆ entries

std::map<string, string> LibThread::TxTable::entries
private

Definition at line 317 of file shared.cc.


The documentation for this class was generated from the following file: