CMS 3D CMS Logo

Public Member Functions | Private Attributes

stor::I2OChain Class Reference

#include <I2OChain.h>

List of all members.

Public Member Functions

void addToChain (I2OChain &newpart)
void addToStaleWindowStartTime (const utils::Duration_t)
uint32_t adler32Checksum () const
void assertRunNumber (uint32_t runNumber)
bool complete () const
unsigned int copyFragmentsIntoBuffer (std::vector< unsigned char > &buff) const
utils::TimePoint_t creationTime () const
unsigned char * dataLocation (int fragmentIndex) const
unsigned long dataSize (int fragmentIndex) const
DQMKey dqmKey () const
unsigned int droppedEventsCount () const
bool empty () const
uint32_t eventNumber () const
bool faulty () const
unsigned int faultyBits () const
unsigned int fragmentCount () const
FragKey fragmentKey () const
unsigned int fuGuid () const
unsigned int fuProcessId () const
unsigned long * getBufferData () const
QueueIDs getDQMEventConsumerTags () const
QueueIDs getEventConsumerTags () const
unsigned int getFragmentID (int fragmentIndex) const
std::vector< StreamIDgetStreamTags () const
unsigned char * headerLocation () const
unsigned long headerSize () const
std::string hltClassName () const
unsigned int hltInstance () const
unsigned int hltLocalId () const
unsigned int hltTid () const
void hltTriggerBits (std::vector< unsigned char > &bitList) const
uint32_t hltTriggerCount () const
void hltTriggerNames (Strings &nameList) const
void hltTriggerSelections (Strings &nameList) const
std::string hltURL () const
 I2OChain (toolbox::mem::Reference *pRef)
 I2OChain ()
 I2OChain (I2OChain const &other)
unsigned short i2oMessageCode () const
bool isEndOfLumiSectionMessage () const
bool isTaggedForAnyDQMEventConsumer () const
bool isTaggedForAnyEventConsumer () const
bool isTaggedForAnyStream () const
void l1TriggerNames (Strings &nameList) const
utils::TimePoint_t lastFragmentTime () const
uint32_t lumiSection () const
void markFaulty ()
size_t memoryUsed () const
unsigned int messageCode () const
I2OChainoperator= (I2OChain const &rhs)
uint32_t outputModuleId () const
std::string outputModuleLabel () const
unsigned int rbBufferId () const
void release ()
void resetStaleWindowStartTime ()
uint32_t runNumber () const
void setDroppedEventsCount (unsigned int)
utils::TimePoint_t staleWindowStartTime () const
void swap (I2OChain &other)
void tagForDQMEventConsumer (QueueID)
void tagForEventConsumer (QueueID)
void tagForStream (StreamID)
std::string topFolderName () const
unsigned long totalDataSize () const
 ~I2OChain ()

Private Attributes

boost::shared_ptr
< detail::ChainData
data_

Detailed Description

Definition at line 42 of file I2OChain.h.


Constructor & Destructor Documentation

stor::I2OChain::I2OChain ( )

A default-constructed I2OChain manages no Reference.

Definition at line 26 of file I2OChain.cc.

Referenced by release().

                    :
    data_()
  {}
stor::I2OChain::I2OChain ( toolbox::mem::Reference *  pRef) [explicit]

Create an I2OChain that will manage the Reference at address pRef, and assure that release is called on it only once, regardless of how many copies of the I2OChain object have been made. NOTE that if the message fragment contained in the XDAQ buffer is corrupted in some way, the chain will be marked "faulty" and should not be used in normal fragment processing.

Definition at line 30 of file I2OChain.cc.

References data_, I2O_SM_DATA, I2O_SM_DQM, I2O_SM_ERROR, I2O_SM_PREAMBLE, and i2oMessageCode().

  {
    if (pRef)
      {
        I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
          (I2O_PRIVATE_MESSAGE_FRAME*) pRef->getDataLocation();
        if (!pvtMsg)
          {
            data_.reset(new detail::ChainData());
            data_->addFirstFragment(pRef);
            return;
          }

        unsigned short i2oMessageCode = pvtMsg->XFunctionCode;
        switch (i2oMessageCode)
          {

          case I2O_SM_PREAMBLE:
            {
              data_.reset(new detail::InitMsgData(pRef));
              break;
            }

          case I2O_SM_DATA:
            {
              data_.reset(new detail::EventMsgData(pRef));
              break;
            }

          case I2O_SM_DQM:
            {
              data_.reset(new detail::DQMEventMsgData(pRef));
              break;
            }

          case I2O_EVM_LUMISECTION:
            {
              data_.reset(new detail::EndLumiSectMsgData(pRef));
              break;
            }

          case I2O_SM_ERROR:
            {
              data_.reset(new detail::ErrorEventMsgData(pRef));
              break;
            }

          default:
            {
              data_.reset(new detail::ChainData());
              data_->addFirstFragment(pRef);
              data_->markCorrupt();
              break;
            }

          }
      }
  }
stor::I2OChain::I2OChain ( I2OChain const &  other)

A copy of an I2OChain shares management of the underlying Reference. We avoid calling Reference::duplicate.

Definition at line 89 of file I2OChain.cc.

                                          :
    data_(other.data_)
  { }
stor::I2OChain::~I2OChain ( )

Destroying an I2OChain does not release the managed Reference, unless that I2OChain is the last one managing that Reference.

Definition at line 93 of file I2OChain.cc.

  { }

Member Function Documentation

void stor::I2OChain::addToChain ( I2OChain newpart)

Adds fragments from another chain to the current chain taking care that all fragments are chained in the right order. This destructively modifies newpart so that it no longer is part of managing any Reference: newpart is made empty.

If newpart contains chain elements that do not have the same fragment key (FragKey) as the current chain, an exception is thrown.

If newpart contains chain elements that already appear to exist in the current chain (e.g. fragment number 3 is added a second time), no exceptions are thrown and newpart is made empty, but the current chain is marked as faulty.

Definition at line 139 of file I2OChain.cc.

References stor::FragKey::code_, complete(), data_, empty(), stor::FragKey::event_, fragmentKey(), runTheMatrix::msg, stor::FragKey::originatorGuid_, stor::FragKey::originatorPid_, release(), stor::FragKey::run_, and stor::FragKey::secondaryId_.

  {
    // fragments can not be added to empty, complete, or faulty chains.
    if (empty())
      {
        XCEPT_RAISE(stor::exception::I2OChain,
                    "A fragment may not be added to an empty chain.");
      }
    if (complete())
      {
        XCEPT_RAISE(stor::exception::I2OChain,
                    "A fragment may not be added to a complete chain.");
      }

    // empty, complete, or faulty new parts can not be added to chains
    if (newpart.empty())
      {
        XCEPT_RAISE(stor::exception::I2OChain,
                    "An empty chain may not be added to an existing chain.");
      }
    if (newpart.complete())
      {
        XCEPT_RAISE(stor::exception::I2OChain,
                    "A complete chain may not be added to an existing chain.");
      }

    // require the new part and this chain to have the same fragment key
    FragKey thisKey = fragmentKey();
    FragKey thatKey = newpart.fragmentKey();
    // should change this to != once we implement that operator in FragKey
    if (thisKey < thatKey || thatKey < thisKey)
      {
        std::stringstream msg;
        msg << "A fragment key mismatch was detected when trying to add "
            << "a chain link to an existing chain. "
            << "Existing key values = ("
            << ((int)thisKey.code_) << "," << thisKey.run_ << ","
            << thisKey.event_ << "," << thisKey.secondaryId_ << ","
            << thisKey.originatorPid_ << "," << thisKey.originatorGuid_
            << "), new key values = ("
            << ((int)thatKey.code_) << "," << thatKey.run_ << ","
            << thatKey.event_ << "," << thatKey.secondaryId_ << ","
            << thatKey.originatorPid_ << "," << thatKey.originatorGuid_
            << ").";
        XCEPT_RAISE(stor::exception::I2OChain, msg.str());
      }

    // add the fragment to the current chain
    data_->addToChain(*(newpart.data_));
    newpart.release();
  }
void stor::I2OChain::addToStaleWindowStartTime ( const utils::Duration_t  duration)

Add the Duration_t in seconds to the stale window start time

Definition at line 308 of file I2OChain.cc.

References data_.

  {
    if (!data_) return;
    data_->addToStaleWindowStartTime(duration);
  }
uint32_t stor::I2OChain::adler32Checksum ( ) const

Returns the adler32 checksum as found in the message if available. Otherwise 0 is returned.

Definition at line 605 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The adler32 checksum can not be determined from an empty I2OChain.");
      }
    return data_->adler32Checksum();
  }
void stor::I2OChain::assertRunNumber ( uint32_t  runNumber)

Checks that the run number found in the I2OChain header corresponds to the run number given as argument. It throws stor::exception::RunNumberMismatch if it is not the case. For error events, the given run number will be used by the StorageManager, but it will *not* be changed in the I2O header.

Definition at line 565 of file I2OChain.cc.

References data_.

Referenced by stor::Processing::do_processI2OFragment().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The run number can not be checked for an empty I2OChain.");
      }
    return data_->assertRunNumber(runNumber);
  }
bool stor::I2OChain::complete ( ) const
unsigned int stor::I2OChain::copyFragmentsIntoBuffer ( std::vector< unsigned char > &  buff) const

Copies the internally managed fragments to the specified vector in one contiguous set. Note that *NO* tests are done by this method - it can be run on empty, incomplete, faulty, and complete chains - and the result could be an incomplete or faulty storage manager message or worse. If the I2O fragments in the chain are corrupt, the data copied into the buffer could be the raw I2O messages, including headers. Returns the number of bytes copied.

Definition at line 469 of file I2OChain.cc.

References data_.

Referenced by stor::DQMEventStore< EventType, ConnectionType, StateMachineType >::getDQMEventView(), and stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_) return 0;
    return data_->copyFragmentsIntoBuffer(targetBuffer);
  }
utils::TimePoint_t stor::I2OChain::creationTime ( ) const

Returns the time when the I2OChain was created. This time corresponds to the time when the first fragment of the I2OChain was added.

The value corresponds to the number of seconds since the epoch (including a fractional part good to the microsecond level). A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 290 of file I2OChain.cc.

References data_.

  {
    if (!data_) return boost::posix_time::not_a_date_time;
    return data_->creationTime();
  }
unsigned char * stor::I2OChain::dataLocation ( int  fragmentIndex) const

Returns the start address of the specified message fragment (indexed from 0 to N-1, where N is the total number of fragments). For complete chains, this method returns pointers to the actual INIT, EVENT, DQM_EVENT, or ERROR_EVENT message fragments. If the chain has been marked as "faulty", this method will still return a valid data location for all fragment indices. However, in that case, the data may not correspond to an underlying INIT, EVENT, etc. message.

Definition at line 444 of file I2OChain.cc.

References data_.

Referenced by stor::EventFileHandler::do_writeEvent(), and stor::FRDFileHandler::do_writeEvent().

  {
    if (!data_) return 0UL;
    return data_->dataLocation(fragmentIndex);
  }
unsigned long stor::I2OChain::dataSize ( int  fragmentIndex) const

Returns the size of the specified message fragment (indexed from 0 to N-1, where N is the total number of fragments). For complete chains, this method returns the sizes of the actual INIT, EVENT, ERROR_EVENT, or DQM_EVENT message fragments. If the chain has been marked as "faulty", this method will still return a valid data size for all fragment indices. However, in that case, the sizes may not correspond to the underlying INIT, EVENT, etc. message.

Definition at line 438 of file I2OChain.cc.

References data_.

Referenced by stor::FRDFileHandler::do_writeEvent().

  {
    if (!data_) return 0UL;
    return data_->dataSize(fragmentIndex);
  }
DQMKey stor::I2OChain::dqmKey ( ) const

Returns the DQM key constructed from the message, if and only if, the message is a DQM event message. Otherwise, an exception is thrown. The DQM key uniquely identifies DQM events to be collated.

Definition at line 495 of file I2OChain.cc.

References data_.

  {
    if( !data_ )
      {
        XCEPT_RAISE( stor::exception::I2OChain,
                     "The DQM key can not be determined from an empty I2OChain." );
      }
    return data_->dqmKey();
  }
unsigned int stor::I2OChain::droppedEventsCount ( ) const

Return the number of dropped events found in the EventHeader

Definition at line 404 of file I2OChain.cc.

References data_, and runTheMatrix::msg.

  {
    if (!data_)
      {
        std::stringstream msg;
        msg << "A dropped event count cannot be retrieved from an empty chain";
        XCEPT_RAISE(stor::exception::I2OChain, msg.str());
      }
    return data_->droppedEventsCount();
  }
bool stor::I2OChain::empty ( void  ) const

Returns true if there is no Reference managed by *this.

Definition at line 110 of file I2OChain.cc.

References data_.

Referenced by addToChain().

  {
    // We're empty if we have no ChainData, or if the ChainData object
    // we have is empty.
    return !data_ || data_->empty();
  }
uint32_t stor::I2OChain::eventNumber ( ) const

Returns the event number of the message, if and only if, the message is an Event or ErrorEvent message. Otherwise an exception is thrown.

Definition at line 595 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addEventSample(), stor::RunMonitorCollection::addUnwantedEvent(), and stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The event number can not be determined from an empty I2OChain.");
      }
    return data_->eventNumber();
  }
bool stor::I2OChain::faulty ( ) const

Returns true if the chain has been marked faulty (the internal data does not represent a valid message fragment or the fragments in the chain do not represent a complete, valid message).

Definition at line 125 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), stor::RunMonitorCollection::addUnwantedEvent(), and stor::DiskWriter::processEndOfLumiSection().

  {
    if (!data_) return false;
    return data_->faulty();
  }
unsigned int stor::I2OChain::faultyBits ( ) const

Returns a bitmask containing the faulty bits.

Definition at line 132 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

  {
    if (!data_) return 0;
    return data_->faultyBits();
  }
unsigned int stor::I2OChain::fragmentCount ( ) const

Returns the number of frames currently contained in the chain. NOTE that this will be less than the total number of expected frames before the chain is complete and equal to the total number of expected frames after the chain is complete. And it can be zero if the chain is empty. If the chain is faulty, this method still returns the number of fragments contained in the chain, but those fragments may not correspond to a valid I2O message.

Definition at line 284 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addFragmentSample(), and stor::FRDFileHandler::do_writeEvent().

  {
    if (!data_) return 0;
    return data_->fragmentCount();
  }
FragKey stor::I2OChain::fragmentKey ( ) const

Returns the fragment key for the chain. The fragment key is the entity that uniquely identifies all of the fragments from a particular event.

Definition at line 278 of file I2OChain.cc.

References data_, and Header::INVALID.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), stor::FragmentStore::addFragment(), and addToChain().

  {
    if (!data_) return FragKey(Header::INVALID,0,0,0,0,0);
    return data_->fragmentKey();
  }
unsigned int stor::I2OChain::fuGuid ( ) const

Returns the filter unit GUID from the contained message. If no valid GUID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 272 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::FilterUnitKey::FilterUnitKey().

  {
    if (!data_) return 0;
    return data_->fuGuid();
  }
unsigned int stor::I2OChain::fuProcessId ( ) const

Returns the filter unit process ID from the contained message. If no valid process ID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 266 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::FilterUnitKey::FilterUnitKey().

  {
    if (!data_) return 0;
    return data_->fuProcessId();
  }
unsigned long * stor::I2OChain::getBufferData ( ) const

Return the address at which the data in buffer managed by the Reference begins. If the chain is empty, a null pointer is returned.

Definition at line 205 of file I2OChain.cc.

References data_.

  {
    return data_ ?  data_->getBufferData() : 0UL;
  }
QueueIDs stor::I2OChain::getDQMEventConsumerTags ( ) const

Returns the list of DQM event consumers (queue IDs) that this chain has been tagged for. An empty list is returned if the chain is empty. NOTE that this method returns a copy of the list, so it should only be used for testing which consumers have been tagged, not* for for modifying the list of tags.

Definition at line 394 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        QueueIDs tmpList;
        return tmpList;
      }
    return data_->getDQMEventConsumerTags();
  }
QueueIDs stor::I2OChain::getEventConsumerTags ( ) const

Returns the list of event consumers (queue IDs) that this chain has been tagged for. An empty list is returned if the chain is empty. NOTE that this method returns a copy of the list, so it should only be used for testing which consumers have been tagged, not* for for modifying the list of tags.

Definition at line 384 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        QueueIDs tmpList;
        return tmpList;
      }
    return data_->getEventConsumerTags();
  }
unsigned int stor::I2OChain::getFragmentID ( int  fragmentIndex) const

Returns the fragmentID of the specified message fragment (indexed from 0 to N-1, where N is the total number of fragments). This value varies from 0 to N-1 and should match the fragment index, so this method is probably only useful for testing.

Definition at line 450 of file I2OChain.cc.

References data_.

  {
    if (!data_) return 0;
    return data_->getFragmentID(fragmentIndex);
  }
std::vector< StreamID > stor::I2OChain::getStreamTags ( ) const

Returns the list of disk streams (stream IDs) that this chain has been tagged for. An empty list is returned if the chain is empty. NOTE that this method returns a copy of the list, so it should only be used for testing which streams have been tagged, not* for for modifying the list of tags.

Definition at line 374 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        std::vector<StreamID> tmpList;
        return tmpList;
      }
    return data_->getStreamTags();
  }
unsigned char * stor::I2OChain::headerLocation ( ) const

Returns the start address of the header part of the message that is contained in the chain. For complete chains of type INIT, EVENT, and DQM_EVENT, this method returns the true pointer to the message header. For other types of chains, and for chains that have been marked "faulty", this method will return a NULL pointer.

Definition at line 462 of file I2OChain.cc.

References data_.

Referenced by stor::EventFileHandler::do_writeEvent().

  {
    if (!data_) return 0UL;
    return data_->headerLocation();
  }
unsigned long stor::I2OChain::headerSize ( ) const

Returns the size of the header part of the message that is contained in the chain. For complete chains of type INIT, EVENT, and DQM_EVENT, this method returns the true size of the message header. For other types of chains, and for chains that have been marked "faulty", this method will return a size of zero.

Definition at line 456 of file I2OChain.cc.

References data_.

  {
    if (!data_) return 0UL;
    return data_->headerSize();
  }
std::string stor::I2OChain::hltClassName ( ) const

Returns the HLT class name from the contained message. If no valid class name can be determined, an empty string is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 260 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey(), and stor::DiscardManager::sendDiscardMessage().

  {
    if (!data_) return "";
    return data_->hltClassName();
  }
unsigned int stor::I2OChain::hltInstance ( ) const

Returns the HLT instance number from the contained message. If no valid instance number can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 242 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey(), and stor::DiscardManager::sendDiscardMessage().

  {
    if (!data_) return 0;
    return data_->hltInstance();
  }
unsigned int stor::I2OChain::hltLocalId ( ) const

Returns the HLT local ID from the contained message. If no valid local ID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 236 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey().

  {
    if (!data_) return 0;
    return data_->hltLocalId();
  }
unsigned int stor::I2OChain::hltTid ( ) const

Returns the HLT TID from the contained message. If no valid TID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 248 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey().

  {
    if (!data_) return 0;
    return data_->hltTid();
  }
void stor::I2OChain::hltTriggerBits ( std::vector< unsigned char > &  bitList) const

Copies the HLT trigger bits into the specified vector, if and only if, the message is an Event message. Otherwise, an exception is thrown. The vector will be resized so that it contains the full number of HLT bits (given by the hltCount() method) with two bits per HLT trigger.

Definition at line 555 of file I2OChain.cc.

References data_.

Referenced by stor::EventConsumerSelector::acceptEvent(), stor::EventStreamSelector::acceptEvent(), and stor::RunMonitorCollection::UnwantedEvent::UnwantedEvent().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "HLT trigger bits can not be determined from an empty I2OChain.");
      }
    data_->hltTriggerBits(bitList);
  }
uint32_t stor::I2OChain::hltTriggerCount ( ) const

Returns the number HLT trigger bits contained in the message, if and only if, the message is an Event message. Otherwise, an exception is thrown.

Definition at line 545 of file I2OChain.cc.

References data_.

Referenced by stor::EventConsumerSelector::acceptEvent(), stor::EventStreamSelector::acceptEvent(), and stor::RunMonitorCollection::UnwantedEvent::UnwantedEvent().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The number of HLT trigger bits can not be determined from an empty I2OChain.");
      }
    return data_->hltTriggerCount();
  }
void stor::I2OChain::hltTriggerNames ( Strings nameList) const

Copies the HLT trigger names into the specified vector, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 515 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "HLT trigger names can not be determined from an empty I2OChain.");
      }
    data_->hltTriggerNames(nameList);
  }
void stor::I2OChain::hltTriggerSelections ( Strings nameList) const

Copies the HLT trigger names into the specified vector, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 525 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "HLT trigger selections can not be determined from an empty I2OChain.");
      }
    data_->hltTriggerSelections(nameList);
  }
std::string stor::I2OChain::hltURL ( ) const

Returns the HLT URL from the contained message. If no valid URL can be determined, an empty string is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 254 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey().

  {
    if (!data_) return "";
    return data_->hltURL();
  }
unsigned short stor::I2OChain::i2oMessageCode ( ) const

Returns the I2O function code for the chain. Valid values are defined in interface/shared/i2oXFunctionCodes.h. If now chain is found, 0xffff is returned.

Definition at line 224 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and I2OChain().

  {
    if (!data_) return 0xffff;
    return data_->i2oMessageCode();
  }
bool stor::I2OChain::isEndOfLumiSectionMessage ( ) const

Returns true if the I2O function code indicates that the message represents an end-of-lumi-section signal.

Definition at line 615 of file I2OChain.cc.

References data_.

Referenced by stor::DiskWriter::writeNextEvent().

  {
    if (!data_) return false;
    return data_->isEndOfLumiSectionMessage();
  }
bool stor::I2OChain::isTaggedForAnyDQMEventConsumer ( ) const

Returns true if the chain has been tagged for any DQM event consumer and false otherwise.

Definition at line 368 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_) return false;
    return data_->isTaggedForAnyDQMEventConsumer();
  }
bool stor::I2OChain::isTaggedForAnyEventConsumer ( ) const

Returns true if the chain has been tagged for any event consumer and false otherwise.

Definition at line 362 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

  {
    if (!data_) return false;
    return data_->isTaggedForAnyEventConsumer();
  }
bool stor::I2OChain::isTaggedForAnyStream ( ) const

Returns true if the chain has been tagged for any disk stream and false otherwise.

Definition at line 356 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

  {
    if (!data_) return false;
    return data_->isTaggedForAnyStream();
  }
void stor::I2OChain::l1TriggerNames ( Strings nameList) const

Copies the L1 trigger names into the specified vector, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 535 of file I2OChain.cc.

References data_.

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "L1 trigger names can not be determined from an empty I2OChain.");
      }
    data_->l1TriggerNames(nameList);
  }
utils::TimePoint_t stor::I2OChain::lastFragmentTime ( ) const

Returns the time when the last fragment was added to the I2OChain.

The value corresponds to the number of seconds since the epoch (including a fractional part good to the microsecond level). A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 296 of file I2OChain.cc.

References data_.

  {
    if (!data_) return boost::posix_time::not_a_date_time;
    return data_->lastFragmentTime();
  }
uint32_t stor::I2OChain::lumiSection ( ) const

Returns the luminosity section of the message, if and only if, the message is an Event or ErrorEvent message. Otherwise an exception is thrown.

Definition at line 585 of file I2OChain.cc.

References data_.

Referenced by stor::DiskWriter::processEndOfLumiSection(), stor::StorageManager::receiveEndOfLumiSectionMessage(), and stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The luminosity section can not be determined from an empty I2OChain.");
      }
    return data_->lumiSection();
  }
void stor::I2OChain::markFaulty ( )

Mark this chain as known to be complete. Mark this chain as known to be faulty. The failure modes that result in a chain being marked faulty include chains that have duplicate fragments and chains that never become complete after a timeout interval.

Definition at line 198 of file I2OChain.cc.

References data_.

Referenced by stor::FragmentStore::getStaleEvent().

  {
    // TODO:: Should we throw an exception if data_ is null? If so, what
    // type? Right now, we do nothing if data_ is null.
    if (data_) data_->markFaulty();
  }
size_t stor::I2OChain::memoryUsed ( ) const

Returns the total memory occupied by all message fragments in the chain. This includes all I2O headers and

Definition at line 426 of file I2OChain.cc.

References data_.

Referenced by stor::FragmentStore::addFragment(), stor::FragmentStore::getStaleEvent(), stor::FragmentProcessor::processOneFragment(), and stor::DiskWriter::writeNextEvent().

  {
    if (!data_) return 0;
    return data_->memoryUsed();
  }
unsigned int stor::I2OChain::messageCode ( ) const
I2OChain & stor::I2OChain::operator= ( I2OChain const &  rhs)

Assigning to an I2OChain causes the left-hand side of the assignment to relinquish management of any Reference it might have had. If the left-hand side was the only chain managing that Reference, it will be released. After the assignment, the left-hand side shares management of the underlying Reference of the right-hand side.

Definition at line 96 of file I2OChain.cc.

References swap(), and cond::rpcobtemp::temp.

  {
    // This is the standard copy/swap algorithm, to obtain the strong
    // exception safety guarantee.
    I2OChain temp(rhs);
    swap(temp);
    return *this;
  }
uint32_t stor::I2OChain::outputModuleId ( ) const

Returns the output module ID contained in the message, if and only if, the message is an INIT or an Event message. Otherwise, an exception is thrown.

Definition at line 505 of file I2OChain.cc.

References data_.

Referenced by stor::EventConsumerSelector::acceptEvent(), stor::EventStreamSelector::acceptEvent(), stor::RunMonitorCollection::addUnwantedEvent(), stor::DataSenderMonitorCollection::getAllNeededPointers(), and stor::FaultyEventStreamHandler::newFileHandler().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The output module ID can not be determined from an empty I2OChain.");
      }
    return data_->outputModuleId();
  }
std::string stor::I2OChain::outputModuleLabel ( ) const

Returns the output module label contained in the message, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 475 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addInitSample().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The output module label can not be determined from an empty I2OChain.");
      }
    return data_->outputModuleLabel();
  }
unsigned int stor::I2OChain::rbBufferId ( ) const

Returns the resource broker buffer ID from the contained message. If no valid buffer ID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 230 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::DiscardManager::sendDiscardMessage().

  {
    if (!data_) return 0;
    return data_->rbBufferId();
  }
void stor::I2OChain::release ( )

Abandon management of the managed Reference, if there is one. After this call, *this will be in the same state as if it had been default-constructed.

Definition at line 210 of file I2OChain.cc.

References I2OChain().

Referenced by stor::FragmentStore::addFragment(), addToChain(), and stor::FragmentStore::getStaleEvent().

  {
    // A default-constructed chain controls no resources; we can
    // relinquish our control over any controlled Reference by
    // becoming like a default-constructed chain.
    I2OChain().swap(*this);
  }
void stor::I2OChain::resetStaleWindowStartTime ( )

Sets the stale window start time to "now".

Definition at line 314 of file I2OChain.cc.

References data_.

Referenced by stor::FragmentStore::addFragment().

  {
    if (!data_) return;
    data_->resetStaleWindowStartTime();
  }
uint32_t stor::I2OChain::runNumber ( ) const

Returns the run number of the message, if and only if, the message is an Event or ErrorEvent message. Otherwise an exception is thrown.

Definition at line 575 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addEventSample(), stor::DiskWriter::processEndOfLumiSection(), and stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_)
      {
        XCEPT_RAISE(stor::exception::I2OChain,
          "The run number can not be determined from an empty I2OChain.");
      }
    return data_->runNumber();
  }
void stor::I2OChain::setDroppedEventsCount ( unsigned int  count)

Add the number of dropped (skipped) events to the EVENT message header.

Definition at line 415 of file I2OChain.cc.

References data_, and runTheMatrix::msg.

  {
    if (!data_)
      {
        std::stringstream msg;
        msg << "A dropped event count cannot be added to an empty chain";
        XCEPT_RAISE(stor::exception::I2OChain, msg.str());
      }
    data_->setDroppedEventsCount(count);
  }
utils::TimePoint_t stor::I2OChain::staleWindowStartTime ( ) const

Returns the stale window start time. This is the time that should be used when checking if a chain has become stale.

The value corresponds to the number of seconds since the epoch (including a fractional part good to the microsecond level). A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 302 of file I2OChain.cc.

References data_.

  {
    if (!data_) return boost::posix_time::not_a_date_time;
    return data_->staleWindowStartTime();
  }
void stor::I2OChain::swap ( I2OChain other)

Standard swap.

Definition at line 105 of file I2OChain.cc.

References data_.

Referenced by operator=().

  {
    data_.swap(other.data_);
  }
void stor::I2OChain::tagForDQMEventConsumer ( QueueID  queueId)

Tags the chain with the specified DQM event consumer queue ID. This means that the data in the chain should be sent to the specified DQM event consumer queue.

Definition at line 344 of file I2OChain.cc.

References data_, and runTheMatrix::msg.

Referenced by stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_)
      {
        std::stringstream msg;
        msg << "An empty chain can not be tagged for a specific ";
        msg << "DQM event consumer.";
        XCEPT_RAISE(stor::exception::I2OChain, msg.str());
      }
    data_->tagForDQMEventConsumer(queueId);
  }
void stor::I2OChain::tagForEventConsumer ( QueueID  queueId)

Tags the chain with the specified event consumer queue ID. This means that the data in the chain should be sent to the specified event consumer queue.

Definition at line 332 of file I2OChain.cc.

References data_, and runTheMatrix::msg.

Referenced by stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_)
      {
        std::stringstream msg;
        msg << "An empty chain can not be tagged for a specific ";
        msg << "event consumer.";
        XCEPT_RAISE(stor::exception::I2OChain, msg.str());
      }
    data_->tagForEventConsumer(queueId);
  }
void stor::I2OChain::tagForStream ( StreamID  streamId)

Tags the chain with the specified disk writing stream ID. This means that the data in the chain should be sent to the specified disk stream.

Definition at line 320 of file I2OChain.cc.

References data_, and runTheMatrix::msg.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::EventDistributor::tagCompleteEventForQueues().

  {
    if (!data_)
      {
        std::stringstream msg;
        msg << "An empty chain can not be tagged for a specific ";
        msg << "event stream.";
        XCEPT_RAISE(stor::exception::I2OChain, msg.str());
      }
    data_->tagForStream(streamId);
  }
std::string stor::I2OChain::topFolderName ( ) const

Returns the top folder contained in the message, if and only if, the message is a DQM event message. Otherwise, an exception is thrown.

Definition at line 485 of file I2OChain.cc.

References data_.

Referenced by stor::DQMEventSelector::acceptEvent().

  {
    if( !data_ )
      {
        XCEPT_RAISE( stor::exception::I2OChain,
                     "The top folder name can not be determined from an empty I2OChain." );
      }
    return data_->topFolderName();
  }
unsigned long stor::I2OChain::totalDataSize ( ) const

Returns the total size of all of the contained message fragments. For chains that are marked complete, this is the size of the actual INIT, EVENT, DQM_EVENT, or ERROR_EVENT message contained in the chain. For incomplete chains, this method will return an invalid value. If the chain has been marked as "faulty", this method will return the total size of the data that will be returned from the dataSize() method on each of the fragments, even though those fragments may not correspond to actual storage manager messages.

Definition at line 432 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addDQMEventSample(), stor::DataSenderMonitorCollection::addErrorEventSample(), stor::DataSenderMonitorCollection::addEventSample(), stor::DataSenderMonitorCollection::addFaultyEventSample(), stor::DataSenderMonitorCollection::addInitSample(), stor::StreamHandler::getFileHandler(), stor::StorageManager::receiveDataMessage(), stor::StorageManager::receiveDQMMessage(), stor::StorageManager::receiveEndOfLumiSectionMessage(), stor::StorageManager::receiveErrorDataMessage(), stor::StorageManager::receiveRegistryMessage(), and stor::StreamHandler::writeEvent().

  {
    if (!data_) return 0UL;
    return data_->totalDataSize();
  }

Member Data Documentation

boost::shared_ptr<detail::ChainData> stor::I2OChain::data_ [private]