CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::IOVEditor Class Reference

#include <IOVEditor.h>

Public Member Functions

unsigned int append (cond::Time_t sinceTime, const std::string &payloadToken)
 Append a payload with known since time. The previous last payload's till time will be adjusted to the new payload since time. Returns the payload index in the iov sequence. More...
 
void bulkAppend (std::vector< std::pair< cond::Time_t, std::string > > &values)
 Bulk append of iov chunck. More...
 
void bulkAppend (std::vector< cond::IOVElement > &values)
 
void create (cond::TimeType timetype)
 
void create (cond::TimeType timetype, cond::Time_t lastTill)
 
void deleteEntries (bool withPayload=false)
 
Time_t firstSince () const
 
unsigned int freeInsert (cond::Time_t sinceTime, const std::string &payloadToken)
 insert a payload with known since in any position More...
 
void import (const std::string &sourceIOVtoken)
 
unsigned int insert (cond::Time_t tillTime, const std::string &payloadToken)
 Assign a payload with till time. Returns the payload index in the iov sequence. More...
 
IOVSequenceiov ()
 
 IOVEditor (cond::DbSession &dbSess)
 
 IOVEditor (cond::DbSession &dbSess, const std::string &token)
 
Time_t lastTill () const
 
void stamp (std::string const &icomment, bool append=false)
 
TimeType timetype () const
 
std::string const & token () const
 Returns the token of the iov sequence associated with this editor. More...
 
unsigned int truncate (bool withPayload=false)
 
void updateClosure (cond::Time_t newtillTime)
 Update the closure of the iov sequence. More...
 
 ~IOVEditor ()
 Destructor. More...
 

Private Member Functions

void debugInfo (std::ostream &co) const
 
void init ()
 
void reportError (std::string message) const
 
void reportError (std::string message, cond::Time_t time) const
 
bool validTime (cond::Time_t time, cond::TimeType timetype) const
 
bool validTime (cond::Time_t time) const
 

Private Attributes

cond::DbSession m_dbSess
 
boost::shared_ptr
< cond::IOVSequence
m_iov
 
bool m_isActive
 
std::string m_token
 

Detailed Description

Definition at line 25 of file IOVEditor.h.

Constructor & Destructor Documentation

IOVEditor::IOVEditor ( cond::DbSession dbSess)
explicit

Definition at line 14 of file IOVEditor.cc.

14  :m_dbSess(dbSess),
15  m_isActive(false){
16  }
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
IOVEditor::IOVEditor ( cond::DbSession dbSess,
const std::string &  token 
)

Definition at line 18 of file IOVEditor.cc.

20  :m_dbSess(dbSess),m_token(token),
21  m_isActive(false){
22  }
std::string m_token
Definition: IOVEditor.h:103
std::string const & token() const
Returns the token of the iov sequence associated with this editor.
Definition: IOVEditor.h:81
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
IOVEditor::~IOVEditor ( )

Destructor.

Definition at line 12 of file IOVEditor.cc.

12 {}

Member Function Documentation

unsigned int IOVEditor::append ( cond::Time_t  sinceTime,
const std::string &  payloadToken 
)

Append a payload with known since time. The previous last payload's till time will be adjusted to the new payload since time. Returns the payload index in the iov sequence.

Definition at line 212 of file IOVEditor.cc.

References init(), lastTill(), m_dbSess, m_iov, m_isActive, m_token, reportError(), runTheMatrix::ret, timetype(), cond::timeTypeSpecs, updateClosure(), cond::DbSession::updateObject(), and validTime().

Referenced by hltFindDuplicates.ModuleList::__init__(), python.Vispa.Views.PropertyView.PropertyView::addProperty(), cond::service::PoolDBOutputService::appendIOV(), cond::service::PoolDBOutputService::createNewIOV(), cond::AlignSplitIOV::execute(), hltFindDuplicates.ModuleList::extend(), and python.seqvaluedict.seqdict::push().

214  {
215  if( m_token.empty() ) {
216  reportError("cond::IOVEditor::appendIOV cannot append to non-existing IOV index");
217  }
218 
219  if(!m_isActive) {
220  this->init();
221  }
222 
223  if(!validTime(sinceTime))
224  reportError("cond::IOVEditor::append time not in global range",sinceTime);
225 
226 
227  if( !m_iov->iovs().empty() ){
228  //range check in case
229  cond::Time_t lastValidSince=m_iov->iovs().back().sinceTime();
230  if( sinceTime<= lastValidSince){
231  reportError("IOVEditor::append Error: since time out of range: below last since",sinceTime);
232  }
233  }
234 
235  // does it make sense? (in case of mixed till and since insertions...)
236  if (lastTill()<=sinceTime) updateClosure(timeTypeSpecs[timetype()].endValue);
237  unsigned int ret = m_iov->add(sinceTime,payloadToken);
239  return ret;
240  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
unsigned long long Time_t
Definition: Time.h:16
TimeType timetype() const
Definition: IOVEditor.cc:113
void updateClosure(cond::Time_t newtillTime)
Update the closure of the iov sequence.
Definition: IOVEditor.cc:204
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::bulkAppend ( std::vector< std::pair< cond::Time_t, std::string > > &  values)

Bulk append of iov chunck.

Definition at line 152 of file IOVEditor.cc.

References firstTime, init(), lastTill(), m_dbSess, m_iov, m_isActive, m_token, reportError(), cond::DbSession::updateObject(), validTime(), and makeHLTPrescaleTable::values.

152  {
153  if (values.empty()) return;
154  if(!m_isActive) this->init();
155  cond::Time_t firstTime = values.front().first;
156  cond::Time_t lastTime = values.back().first;
157  if(!validTime(firstTime))
158  reportError("cond::IOVEditor::bulkInsert first time not in global range",firstTime);
159 
160  if(!validTime(lastTime))
161  reportError("cond::IOVEditor::bulkInsert last time not in global range",lastTime);
162 
163  if(lastTime>=lastTill() ||
164  ( !m_iov->iovs().empty() && firstTime<=m_iov->iovs().back().sinceTime())
165  )
166  reportError("cond::IOVEditor::bulkInsert IOV not in range",firstTime);
167 
168  for(std::vector< std::pair<cond::Time_t,std::string> >::const_iterator it=values.begin(); it!=values.end(); ++it){
169  // m_iov->iov.insert(m_iov->iov.end(), values.begin(), values.end());
170  m_iov->add(it->first,it->second);
171  }
173  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
unsigned long long Time_t
Definition: Time.h:16
bool firstTime
Definition: QTestHandle.cc:18
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::bulkAppend ( std::vector< cond::IOVElement > &  values)

Definition at line 176 of file IOVEditor.cc.

References firstTime, init(), lastTill(), m_dbSess, m_iov, m_isActive, m_token, reportError(), cond::DbSession::updateObject(), and validTime().

176  {
177  if (values.empty()) return;
178  if(!m_isActive) this->init();
179  cond::Time_t firstTime = values.front().sinceTime();
180  cond::Time_t lastTime = values.back().sinceTime();
181  if(!validTime(firstTime))
182  reportError("cond::IOVEditor::bulkInsert first time not in global range",firstTime);
183 
184  if(!validTime(lastTime))
185  reportError("cond::IOVEditor::bulkInsert last time not in global range",lastTime);
186 
187  if(lastTime>=lastTill() ||
188  ( !m_iov->iovs().empty() && firstTime<=m_iov->iovs().back().sinceTime())
189  ) reportError("cond::IOVEditor::bulkInsert IOV not in range",firstTime);
190 
192  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
unsigned long long Time_t
Definition: Time.h:16
bool firstTime
Definition: QTestHandle.cc:18
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::create ( cond::TimeType  timetype)

Definition at line 67 of file IOVEditor.cc.

References cond::IOVNames::container(), m_dbSess, m_iov, m_isActive, m_token, reportError(), and cond::DbSession::storeObject().

Referenced by cond::service::PoolDBOutputService::createNewIOV(), and cond::AlignSplitIOV::execute().

67  {
68  if(!m_token.empty()){
69  // problem??
70  reportError("cond::IOVEditor::create cannot create a IOV using an initialized Editor");
71  }
72 
73  m_iov.reset( new cond::IOVSequence(timetype) );
75  m_isActive=true;
76 
77  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
std::string m_token
Definition: IOVEditor.h:103
TimeType timetype() const
Definition: IOVEditor.cc:113
std::string storeObject(const T *object, const std::string &containerName)
Definition: DbSession.h:104
static std::string container()
Definition: futureIOVNames.h:7
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::create ( cond::TimeType  timetype,
cond::Time_t  lastTill 
)

Definition at line 79 of file IOVEditor.cc.

References cond::IOVNames::container(), m_dbSess, m_iov, m_isActive, m_token, reportError(), cond::DbSession::storeObject(), and validTime().

79  {
80  if(!m_token.empty()){
81  // problem??
82  reportError("cond::IOVEditor::create cannot create a IOV using an initialized Editor");
83  }
84 
86  reportError("cond::IOVEditor::create time not in global range",lastTill);
87 
88  m_iov.reset( new cond::IOVSequence((int)timetype,lastTill," ") );
90  m_isActive=true;
91  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
TimeType timetype() const
Definition: IOVEditor.cc:113
std::string storeObject(const T *object, const std::string &containerName)
Definition: DbSession.h:104
static std::string container()
Definition: futureIOVNames.h:7
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::debugInfo ( std::ostream &  co) const
private

Definition at line 27 of file IOVEditor.cc.

References cond::DbSession::connectionString(), m_dbSess, m_iov, m_token, cond::TimeTypeSpecs::name, and cond::timeTypeSpecs.

Referenced by reportError().

27  {
28  co << "IOVEditor: ";
29  co << "db " << m_dbSess.connectionString();
30  if(m_token.empty()) {
31  co << " no token"; return;
32  }
33  if (!m_iov.get() ) {
34  co << " no iov for token " << m_token;
35  return;
36  }
37  co << " iov token " << m_token;
38  co << "\nStamp: " << m_iov->comment()
39  << "; time " << m_iov->timestamp()
40  << "; revision " << m_iov->revision();
41  co <<". TimeType " << cond::timeTypeSpecs[ m_iov->timeType()].name;
42  if( m_iov->iovs().empty() )
43  co << ". empty";
44  else
45  co << ". size " << m_iov->iovs().size()
46  << "; last since " << m_iov->iovs().back().sinceTime();
47  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
const std::string & connectionString() const
Definition: DbSession.cc:133
std::string m_token
Definition: IOVEditor.h:103
std::string name
Definition: Time.h:43
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::deleteEntries ( bool  withPayload = false)

Definition at line 296 of file IOVEditor.cc.

References cond::DbSession::deleteObject(), init(), m_dbSess, m_iov, m_isActive, m_token, and reportError().

296  {
297  if( m_token.empty() ) reportError("cond::IOVEditor::deleteEntries cannot delete to non-existing IOV sequence");
298  if(!m_isActive) this->init();
299  if(withPayload){
300  std::string tokenStr;
301  IOVSequence::const_iterator payloadIt;
302  IOVSequence::const_iterator payloadItEnd=m_iov->piovs().end();
303  for(payloadIt=m_iov->piovs().begin();payloadIt!=payloadItEnd;++payloadIt){
304  tokenStr=payloadIt->wrapperToken();
305  m_dbSess.deleteObject( tokenStr );
306  }
307  }
309  m_iov->piovs().clear();
310  }
bool deleteObject(const std::string &objectId)
Definition: DbSession.cc:207
void reportError(std::string message) const
Definition: IOVEditor.cc:49
std::string m_token
Definition: IOVEditor.h:103
Container::const_iterator const_iterator
Definition: IOVSequence.h:27
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
Time_t IOVEditor::firstSince ( ) const

Definition at line 105 of file IOVEditor.cc.

References m_iov.

105  {
106  return m_iov->firstSince();
107  }
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
unsigned int IOVEditor::freeInsert ( cond::Time_t  sinceTime,
const std::string &  payloadToken 
)

insert a payload with known since in any position

Definition at line 244 of file IOVEditor.cc.

References cond::TimeTypeSpecs::endValue, init(), lastTill(), m_dbSess, m_iov, m_isActive, m_token, reportError(), runTheMatrix::ret, timetype(), cond::timeTypeSpecs, updateClosure(), cond::DbSession::updateObject(), and validTime().

Referenced by cond::service::PoolDBOutputService::appendIOV().

246  {
247  // reportError("cond::IOVEditor::freeInsert not supported yet");
248 
249  if( m_token.empty() ) {
250  reportError("cond::IOVEditor::freeInsert cannot append to non-existing IOV index");
251  }
252 
253  if(!m_isActive) {
254  this->init();
255  }
256 
257  // if( m_iov->iov.empty() ) reportError("cond::IOVEditor::freeInsert cannot insert to empty IOV index");
258 
259 
260  if(!validTime(sinceTime))
261  reportError("cond::IOVEditor::freeInsert time not in global range",sinceTime);
262 
263 
264  // we do not support multiple iov with identical since...
265  if (m_iov->exist(sinceTime))
266  reportError("cond::IOVEditor::freeInsert sinceTime already existing",sinceTime);
267 
268 
269 
270  // does it make sense? (in case of mixed till and since insertions...)
272  unsigned int ret = m_iov->add(sinceTime,payloadToken);
273 
275  return ret;
276  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
TimeType timetype() const
Definition: IOVEditor.cc:113
void updateClosure(cond::Time_t newtillTime)
Update the closure of the iov sequence.
Definition: IOVEditor.cc:204
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
Time_t endValue
Definition: Time.h:46
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::import ( const std::string &  sourceIOVtoken)

Definition at line 313 of file IOVEditor.cc.

References cond::DbSession::getTypedObject(), m_dbSess, m_iov, m_token, and reportError().

313  {
314  if( !m_token.empty() ) reportError("cond::IOVEditor::import IOV sequence already exists, cannot import");
315  m_iov = m_dbSess.getTypedObject<cond::IOVSequence>(sourceIOVtoken);
316  //m_token=m_iov.toString();
317  m_token=sourceIOVtoken;
318  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
std::string m_token
Definition: IOVEditor.h:103
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
boost::shared_ptr< T > getTypedObject(const std::string &objectId)
Definition: DbSession.h:98
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::init ( void  )
private

Definition at line 93 of file IOVEditor.cc.

References cond::DbSession::getTypedObject(), m_dbSess, m_iov, m_isActive, m_token, and reportError().

Referenced by append(), bulkAppend(), deleteEntries(), freeInsert(), insert(), stamp(), truncate(), and updateClosure().

93  {
94  if(m_token.empty()){
95  // problem?
96  reportError("cond::IOVEditor::init cannot init w/o token change");
97  }
98 
100  m_isActive=true;
101 
102  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
std::string m_token
Definition: IOVEditor.h:103
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
boost::shared_ptr< T > getTypedObject(const std::string &objectId)
Definition: DbSession.h:98
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
unsigned int IOVEditor::insert ( cond::Time_t  tillTime,
const std::string &  payloadToken 
)

Assign a payload with till time. Returns the payload index in the iov sequence.

Definition at line 130 of file IOVEditor.cc.

References init(), lastTill(), m_dbSess, m_iov, m_isActive, m_token, reportError(), runTheMatrix::ret, updateClosure(), cond::DbSession::updateObject(), and validTime().

132  {
133  if(!m_isActive) this->init();
134 
135  if( m_iov->iovs().empty() )
136  reportError("cond::IOVEditor::insert cannot inser into empty IOV sequence",tillTime);
137 
138  if(!validTime(tillTime))
139  reportError("cond::IOVEditor::insert time not in global range",tillTime);
140 
141  if(tillTime<=lastTill() )
142  reportError("cond::IOVEditor::insert IOV not in range",tillTime);
143 
144  cond::Time_t newSince=lastTill()+1;
145  unsigned int ret = m_iov->add(newSince, payloadToken);
146  updateClosure(tillTime);
148  return ret;
149  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
unsigned long long Time_t
Definition: Time.h:16
void updateClosure(cond::Time_t newtillTime)
Update the closure of the iov sequence.
Definition: IOVEditor.cc:204
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
IOVSequence & IOVEditor::iov ( )

Definition at line 24 of file IOVEditor.cc.

References m_iov.

24 { return *m_iov;}
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
Time_t IOVEditor::lastTill ( ) const

Definition at line 109 of file IOVEditor.cc.

References m_iov.

Referenced by append(), bulkAppend(), freeInsert(), and insert().

109  {
110  return m_iov->lastTill();
111  }
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
void IOVEditor::reportError ( std::string  message) const
private

Definition at line 49 of file IOVEditor.cc.

References debugInfo(), edm::hlt::Exception, argparse::message, and dbtoconf::out.

Referenced by append(), bulkAppend(), create(), deleteEntries(), freeInsert(), import(), init(), insert(), truncate(), and updateClosure().

49  {
50  std::ostringstream out;
51  out << "Error in ";
52  debugInfo(out);
53  out << "\n" << message;
54  throw cond::Exception(out.str());
55  }
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:27
tuple out
Definition: dbtoconf.py:99
string message
Definition: argparse.py:126
void IOVEditor::reportError ( std::string  message,
cond::Time_t  time 
) const
private

Definition at line 57 of file IOVEditor.cc.

References debugInfo(), edm::hlt::Exception, dbtoconf::out, and cond::rpcobgas::time.

57  {
58  std::ostringstream out;
59  out << "Error in";
60  debugInfo(out);
61  out << "\n" << message << " for time: " << time;
62  throw cond::Exception(out.str());
63  }
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:27
tuple out
Definition: dbtoconf.py:99
string message
Definition: argparse.py:126
void IOVEditor::stamp ( std::string const &  icomment,
bool  append = false 
)

Definition at line 196 of file IOVEditor.cc.

References init(), m_dbSess, m_iov, m_isActive, m_token, and cond::DbSession::updateObject().

Referenced by cond::service::PoolDBOutputService::appendIOV(), cond::service::PoolDBOutputService::closeIOV(), cond::service::PoolDBOutputService::createNewIOV(), and cond::AlignSplitIOV::execute().

196  {
197  if(!m_isActive) this->init();
198  m_iov->stamp(icomment, append);
200  }
std::string m_token
Definition: IOVEditor.h:103
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
Append a payload with known since time. The previous last payload&#39;s till time will be adjusted to the...
Definition: IOVEditor.cc:212
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
TimeType IOVEditor::timetype ( ) const

Definition at line 113 of file IOVEditor.cc.

References m_iov.

Referenced by append(), freeInsert(), and validTime().

113  {
114  return m_iov->timeType();
115  }
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
std::string const& cond::IOVEditor::token ( ) const
inline

Returns the token of the iov sequence associated with this editor.

Definition at line 81 of file IOVEditor.h.

References m_token.

Referenced by cond::service::PoolDBOutputService::createNewIOV(), and cond::AlignSplitIOV::execute().

81 { return m_token;}
std::string m_token
Definition: IOVEditor.h:103
unsigned int IOVEditor::truncate ( bool  withPayload = false)

Definition at line 280 of file IOVEditor.cc.

References cond::DbSession::deleteObject(), init(), m_dbSess, m_iov, m_isActive, m_token, reportError(), runTheMatrix::ret, and cond::DbSession::updateObject().

Referenced by python.Vispa.Gui.VispaWidget.TextField::calculateDimensions().

280  {
281  if( m_token.empty() ) reportError("cond::IOVEditor::truncate cannot delete to non-existing IOV sequence");
282  if(!m_isActive) this->init();
283  if (m_iov->piovs().empty()) return 0;
284  if(withPayload){
285  std::string tokenStr = m_iov->piovs().back().wrapperToken();
286  m_dbSess.deleteObject( tokenStr );
287  }
288  unsigned int ret = m_iov->truncate();
290  return ret;
291 
292  }
bool deleteObject(const std::string &objectId)
Definition: DbSession.cc:207
void reportError(std::string message) const
Definition: IOVEditor.cc:49
std::string m_token
Definition: IOVEditor.h:103
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
void IOVEditor::updateClosure ( cond::Time_t  newtillTime)

Update the closure of the iov sequence.

Definition at line 204 of file IOVEditor.cc.

References init(), m_dbSess, m_iov, m_isActive, m_token, reportError(), and cond::DbSession::updateObject().

Referenced by append(), cond::service::PoolDBOutputService::appendIOV(), cond::service::PoolDBOutputService::closeIOV(), freeInsert(), and insert().

204  {
205  if( m_token.empty() ) reportError("cond::IOVEditor::updateClosure cannot change non-existing IOV index");
206  if(!m_isActive) this->init();
207  m_iov->updateLastTill(newtillTime);
209  }
void reportError(std::string message) const
Definition: IOVEditor.cc:49
std::string m_token
Definition: IOVEditor.h:103
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
bool updateObject(const T *object, const std::string &objectId)
Definition: DbSession.h:117
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
bool IOVEditor::validTime ( cond::Time_t  time,
cond::TimeType  timetype 
) const
private

Definition at line 118 of file IOVEditor.cc.

References cond::TimeTypeSpecs::beginValue, cond::TimeTypeSpecs::endValue, timetype(), and cond::timeTypeSpecs.

Referenced by append(), bulkAppend(), create(), freeInsert(), insert(), and validTime().

118  {
120 
121  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
Time_t beginValue
Definition: Time.h:45
TimeType timetype() const
Definition: IOVEditor.cc:113
Time_t endValue
Definition: Time.h:46
bool IOVEditor::validTime ( cond::Time_t  time) const
private

Definition at line 123 of file IOVEditor.cc.

References timetype(), and validTime().

123  {
124  return validTime(time,timetype());
125  }
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
TimeType timetype() const
Definition: IOVEditor.cc:113

Member Data Documentation

cond::DbSession cond::IOVEditor::m_dbSess
private
boost::shared_ptr<cond::IOVSequence> cond::IOVEditor::m_iov
private
bool cond::IOVEditor::m_isActive
private
std::string cond::IOVEditor::m_token
private