NCBI C++ ToolKit
event_log_service_impl.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: event_log_service_impl.cpp 31806 2014-11-17 18:18:01Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrey Yazhuk
27  *
28  * File Description:
29  */
30 
31 #include <ncbi_pch.hpp>
32 
33 #include <corelib/ncbistd.hpp>
34 
36 
38 
39 
41 
42 
43 CEventRecord::CEventRecord(EType type, const string& title,
44  const string& descr, const TTime& time)
45 : m_Type(type),
46  m_Title(title),
47  m_Description(descr),
48  m_Time(time)
49 {
50 }
51 
52 
54 {
55  return m_Type;
56 }
57 
58 
59 string CEventRecord::GetTitle() const
60 {
61  return m_Title;
62 }
63 
64 
66 {
67  return m_Description;
68 }
69 
70 
72 {
73  return m_Time;
74 }
75 
76 
78 {
79  m_Type = type;
80 }
81 
82 
83 void CEventRecord::SetTitle(const string& title)
84 {
85  m_Title = title;
86 }
87 
88 
89 void CEventRecord::SetDescription(const string& descr)
90 {
91  m_Description = descr;
92 }
93 
94 
95 void CEventRecord::SetTime(const TTime& time)
96 {
97  m_Time = time;
98 }
99 
100 ///////////////////////////////////////////////////////////////////////////////
101 /// CEventLogService
103 {
104 }
105 
106 
108 {
109 }
110 
111 
113 {
114  m_Records.clear();
115 }
116 
117 
119 {
120  _ASSERT(record);
121 
122  if(record) {
123  m_Records.push_back(CIRef<IEventRecord>(record));
125  }
126 }
127 
128 
130 {
131  return m_Records.size();
132 }
133 
134 
135 const IEventRecord* CEventLogService::GetRecord(size_t index) const
136 {
137  bool valid_index = /*index >= 0 &&*/ index < m_Records.size();
138  _ASSERT(valid_index);
139  return valid_index ? m_Records[index].GetPointer() : NULL;
140 }
141 
142 
IEventRecord.
Include a standard set of the NCBI C++ Toolkit most basic headers.
static int type
Definition: getdata.c:31
#define NULL
Definition: ncbistd.hpp:225
virtual const IEventRecord * GetRecord(size_t index) const
returns the record with the specified index
virtual const TTime & GetTime() const
CEventRecord(EType type, const string &title=kEmptyStr, const string &descr=kEmptyStr, const TTime &time=0)
virtual string GetTitle() const
virtual void ShutDownService()
virtual size_t GetRecordsCount() const
returns the total number of records
virtual void SetType(EType type)
virtual void AddRecord(IEventRecord *record)
Records are managed by CIRef inside the service.
virtual EType GetType() const
virtual void SetDescription(const string &descr)
CEventLogService()
CEventLogService.
virtual void SetTime(const TTime &time)
virtual string GetDescription() const
virtual void SetTitle(const string &title)
void Post(CRef< CEvent > evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Handles an event asynchronously (process and/or dispatch).
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Definition: type.c:6
#define _ASSERT
Modified on Wed Apr 17 13:10:37 2024 by modify_doxy.py rev. 669887