SetEnabled(
boolenable =
true);
152 static boolIsEnabled(
void);
167 static voidSetDefaultParameters(
TWhatwhat = fDefault);
168 static TWhatGetDefaultParameters(
void);
183 static voidSetURL(
const string& url);
184 static stringGetURL(
void);
203 static voidSetAppName(
const string& name);
204 static stringGetAppName(
void);
223 static voidSetAppVersion(
const string&
version);
225 static stringGetAppVersion(
void);
251 static voidSetMaxQueueSize(
unsigned n);
252 static unsignedGetMaxQueueSize();
269 static voidSetTimeout(
const CTimeout& timeout);
292 static voidSetRetries(
intretries);
297 static intGetRetries();
302 static boolCheckConnection();
331 template<
typenameTValue>
502 CUsageReport(
TWhatwhat = fDefault,
const string& url =
string(),
unsignedmax_queue_size = 0);
517 void SetEnabled(
boolenable =
true) { m_IsEnabled = enable; }
523 boolIsEnabled(
void);
573 template<
typenameTJob>
void Send(TJob& job)
577x_SendAsync(job_ptr);
582 unsignedGetQueueSize(
void);
587 voidClearQueue(
void);
643 boolCheckConnection();
655 boolx_Send(
const string& extra_params);
657 voidx_SendAsync(
TJobPtrjob_ptr);
659 voidx_ThreadHandler(
void);
661 voidx_ClearQueue(
void);
666 #if defined(NCBI_USAGE_REPORT_SUPPORTED) 707 #define NCBI_REPORT_USAGE(event, ...) __NCBI_REPORT_USAGE(event, __VA_ARGS__) 709 #define __NCBI_REPORT_USAGE(event, args) \ 711 CUsageReport& reporter = CUsageReport::Instance(); \ 712 if (reporter.IsEnabled()) { \ 713 CUsageReportParameters params; \ 714 params.Add("jsevent", (event)) args; \
715reporter.Send(params); \
721 #define NCBI_REPORT_USAGE_START CUsageReportAPI::SetEnabled() 726 #define NCBI_REPORT_USAGE_WAIT CUsageReport::Instance().Wait(CUsageReport::eAlways) 727 #define NCBI_REPORT_USAGE_WAIT_ALWAYS CUsageReport::Instance().Wait(CUsageReport::eAlways) 728 #define NCBI_REPORT_USAGE_WAIT_TIMEOUT(t) CUsageReport::Instance().Wait(CUsageReport::eAlways, t) 729 #define NCBI_REPORT_USAGE_WAIT_IF_SUCCESS CUsageReport::Instance().Wait(CUsageReport::eSkipIfNoConnection) 733 #define NCBI_REPORT_USAGE_FINISH CUsageReport::Instance().Finish()CTimeout â Timeout interval.
CUsageReportAPI:: Global settings related to the usage reporting.
CUsageReportBase:: Base class to define common types for CUsageReport API.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
std::thread m_Thread
Reporting thread.
string m_URL
Reporting URL.
std::mutex m_Usage_Mutex
MT-protection to access members.
std::map< string, string > m_Params
Stored parameters.
CUsageReportParameters(void)
virtual void OnStateChange(EState)
Callback for async reporting.
std::condition_variable m_ThreadSignal
Signal conditional variable for reporting thread synchronization.
EWait m_WaitMode
Waiting mode.
std::mutex m_ThreadSignal_Mutex
CUsageReport(const CUsageReport &)=delete
Prevent copying.
CUsageReportJob & operator=(const CUsageReportJob &other)
Copy assignment operator.
bool m_IsEnabled
Enable/disable status.
size_t m_CountTotal
Statistics: number of jobs processed.
EState GetState()
Return current job state.
int TWhat
Binary OR of "EWhat".
CUsageReportParameters & Add(const string &name, TValue value)
EWhat
Defines what information should be reported by default by all reporters, in addition to passed parame...
bool m_IsFinishing
TRUE if Finish() has called and reporting thread should terminate.
void SetEnabled(bool enable=true)
Enable or disable usage reporter (current instance only).
EState m_State
Job state.
unsigned m_MaxQueueSize
Maximum allowed queue size.
CUsageReport & operator=(const CUsageReport &)=delete
string m_DefaultParams
Default parameters to report, concatenated and URL-encoded.
CUsageReportParameters & operator=(const CUsageReportParameters &other)
Copy assignment operator.
CDeadline m_WaitDeadline
Deadline for Wait(), if active.
CUsageReportParameters(const CUsageReportParameters &other)
Copy constructor.
bool m_IsWaiting
TRUE if Wait() is active.
size_t m_CountSent
Statistics: number of jobs successfully sent.
CUsageReportJob(const CUsageReportJob &other)
Copy constructor.
CUsageReportJob(void)
Default constructor.
list< TJobPtr > m_Queue
Job queue.
void Send(TJob &job)
Report usage statistics (asynchronously) (advanced version).
virtual ~CUsageReportJob(void)
Destructor.
@ fNone
No defaults, all parameters should be specified via CUsageReportParameters directly.
@ fAppVersion
Application version ("version")
@ fHost
Host name ("host")
@ fAppName
Application name ("appname")
@ eQueued
Added to queue (sending temporary postpones)
@ eFailed
Result: send failed.
@ eCanceled
Result: canceled / removed from queue.
@ eCompleted
Result: successfully sent.
@ eCreated
Initial state, not reported to OnStateChange()
@ eRunning
Ready to send.
@ eAlways
Always wait (default);.
@ eDefault
Default timeout (to be interpreted by the client code)
#define NCBI_XCONNECT_EXPORT
const string version
version string
const GenericPointer< typename T::ValueType > T2 value
The NCBI C++/STL use hints.
Defines: CTimeFormat - storage class for time format.
string ToString(const wxRect &rc)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4