// MANIPULATORS
 int pushBack(const TYPE& value)
     // Append the specified 'value' to this thread-enabled vector and
     // return the index of the new element.
 {
     bslmt::LockGuard<bslmt::Mutex> guard(&d_mutex);
     d_elements.push_back(value);
     return static_cast<int>(d_elements.size()) - 1;
 }
Example #2
0
 inline
 int my_RecordBuffer::pushBack(
                      const bsl::shared_ptr<ball::Record>& handle)
 {
     bslmt::LockGuard<bslmt::RecursiveMutex> guard(&d_mutex);
     d_buffer.push_back(handle);
     return 0;
 }
Example #3
0
// MANIPULATORS
void my_Logger::logMessage(const bsl::string& message, Severity severity)
{
    archive.push_back(message);
    switch (severity) {
      case TRACE: {
        // Do nothing beyond archiving the message.
      } break;
      case WARN: {
        ball::Context context(ball::Transmission::e_PASSTHROUGH, 0, 1);
        publish(message, context);
      } break;
      case ERROR: {
        int index  = 0;
        int length = (int)archive.size();
        ball::Context context(ball::Transmission::e_TRIGGER, index, length);
        while (length--) {
            publish(archive[length], context);
            context.setRecordIndexRaw(++index);
        }
        archive.clear();  // flush archive
      } break;
    }
}