Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CUserReporterWorker Class Reference

Public Member Functions

 CUserReporterWorker (const std::string &userID, const std::string &url)
 
 ~CUserReporterWorker ()
 
void SetEnabled (bool enabled)
 Called by main thread, when the online reporting is enabled/disabled. More...
 
bool Shutdown ()
 Called by main thread to request shutdown. More...
 
std::string GetStatus ()
 Called by main thread to determine the current status of the uploader. More...
 
void Submit (const shared_ptr< CUserReport > &report)
 Called by main thread to add a new report to the queue. More...
 
void Update ()
 Called by the main thread every frame, so we can check retransmission timers. More...
 

Private Member Functions

void Run ()
 
bool GetEnabled ()
 
bool GetShutdown ()
 
void SetStatus (const std::string &status)
 
bool ProcessReport ()
 
void ConstructRequestData (const CUserReport &report)
 
void AppendEscaped (std::string &buffer, const std::string &str)
 

Static Private Member Functions

static void * RunThread (void *data)
 
static size_t ReceiveCallback (void *buffer, size_t size, size_t nmemb, void *userp)
 
static size_t SendCallback (char *bufptr, size_t size, size_t nmemb, void *userp)
 

Private Attributes

pthread_t m_WorkerThread
 
CMutex m_WorkerMutex
 
SDL_semm_WorkerSem
 
std::deque< shared_ptr
< CUserReport > > 
m_ReportQueue
 
bool m_Enabled
 
bool m_Shutdown
 
std::string m_Status
 
std::string m_URL
 
std::string m_UserID
 
CURL * m_Curl
 
curl_slist * m_Headers
 
double m_PauseUntilTime
 
std::string m_ResponseData
 
std::string m_RequestData
 
size_t m_RequestDataOffset
 
char m_ErrorBuffer [CURL_ERROR_SIZE]
 
double m_LastUpdateTime
 

Detailed Description

Definition at line 83 of file UserReport.cpp.

Constructor & Destructor Documentation

CUserReporterWorker::CUserReporterWorker ( const std::string &  userID,
const std::string &  url 
)
inline

Definition at line 86 of file UserReport.cpp.

CUserReporterWorker::~CUserReporterWorker ( )
inline

Definition at line 142 of file UserReport.cpp.

Member Function Documentation

void CUserReporterWorker::AppendEscaped ( std::string &  buffer,
const std::string &  str 
)
inlineprivate

Definition at line 432 of file UserReport.cpp.

void CUserReporterWorker::ConstructRequestData ( const CUserReport report)
inlineprivate

Definition at line 399 of file UserReport.cpp.

bool CUserReporterWorker::GetEnabled ( )
inlineprivate

Definition at line 308 of file UserReport.cpp.

bool CUserReporterWorker::GetShutdown ( )
inlineprivate

Definition at line 314 of file UserReport.cpp.

std::string CUserReporterWorker::GetStatus ( )
inline

Called by main thread to determine the current status of the uploader.

Definition at line 194 of file UserReport.cpp.

bool CUserReporterWorker::ProcessReport ( )
inlineprivate

Definition at line 329 of file UserReport.cpp.

static size_t CUserReporterWorker::ReceiveCallback ( void *  buffer,
size_t  size,
size_t  nmemb,
void *  userp 
)
inlinestaticprivate

Definition at line 439 of file UserReport.cpp.

void CUserReporterWorker::Run ( )
inlineprivate

Definition at line 241 of file UserReport.cpp.

static void* CUserReporterWorker::RunThread ( void *  data)
inlinestaticprivate

Definition at line 231 of file UserReport.cpp.

static size_t CUserReporterWorker::SendCallback ( char *  bufptr,
size_t  size,
size_t  nmemb,
void *  userp 
)
inlinestaticprivate

Definition at line 451 of file UserReport.cpp.

void CUserReporterWorker::SetEnabled ( bool  enabled)
inline

Called by main thread, when the online reporting is enabled/disabled.

Definition at line 155 of file UserReport.cpp.

void CUserReporterWorker::SetStatus ( const std::string &  status)
inlineprivate

Definition at line 320 of file UserReport.cpp.

bool CUserReporterWorker::Shutdown ( void  )
inline

Called by main thread to request shutdown.

Returns true if we've shut down successfully. Returns false if shutdown is taking too long (we might be blocked on a sync network operation) - you mustn't destroy this object, just leak it and terminate.

Definition at line 174 of file UserReport.cpp.

void CUserReporterWorker::Submit ( const shared_ptr< CUserReport > &  report)
inline

Called by main thread to add a new report to the queue.

Definition at line 203 of file UserReport.cpp.

void CUserReporterWorker::Update ( )
inline

Called by the main thread every frame, so we can check retransmission timers.

Definition at line 218 of file UserReport.cpp.

Member Data Documentation

CURL* CUserReporterWorker::m_Curl
private

Definition at line 492 of file UserReport.cpp.

bool CUserReporterWorker::m_Enabled
private

Definition at line 485 of file UserReport.cpp.

char CUserReporterWorker::m_ErrorBuffer[CURL_ERROR_SIZE]
private

Definition at line 500 of file UserReport.cpp.

curl_slist* CUserReporterWorker::m_Headers
private

Definition at line 493 of file UserReport.cpp.

double CUserReporterWorker::m_LastUpdateTime
private

Definition at line 503 of file UserReport.cpp.

double CUserReporterWorker::m_PauseUntilTime
private

Definition at line 494 of file UserReport.cpp.

std::deque<shared_ptr<CUserReport> > CUserReporterWorker::m_ReportQueue
private

Definition at line 484 of file UserReport.cpp.

std::string CUserReporterWorker::m_RequestData
private

Definition at line 498 of file UserReport.cpp.

size_t CUserReporterWorker::m_RequestDataOffset
private

Definition at line 499 of file UserReport.cpp.

std::string CUserReporterWorker::m_ResponseData
private

Definition at line 497 of file UserReport.cpp.

bool CUserReporterWorker::m_Shutdown
private

Definition at line 486 of file UserReport.cpp.

std::string CUserReporterWorker::m_Status
private

Definition at line 487 of file UserReport.cpp.

std::string CUserReporterWorker::m_URL
private

Definition at line 490 of file UserReport.cpp.

std::string CUserReporterWorker::m_UserID
private

Definition at line 491 of file UserReport.cpp.

CMutex CUserReporterWorker::m_WorkerMutex
private

Definition at line 479 of file UserReport.cpp.

SDL_sem* CUserReporterWorker::m_WorkerSem
private

Definition at line 480 of file UserReport.cpp.

pthread_t CUserReporterWorker::m_WorkerThread
private

Definition at line 478 of file UserReport.cpp.


The documentation for this class was generated from the following file: