ewmscp  ..
Public Member Functions | Private Attributes | List of all members
getlineWithTimeout::nocopyLine Class Reference

#include <getlineWithTimeout.h>

Collaboration diagram for getlineWithTimeout::nocopyLine:
[legend]

Public Member Functions

template<typename durationType >
 nocopyLine (getlineWithTimeout &aLineGetter, durationType timeout)
 
bool timedOut () const
 
std::string & line ()
 
 ~nocopyLine ()
 

Private Attributes

getlineWithTimeoutlineGetter
 
std::unique_lock< decltype(getlineWithTimeout::lineMutex)> lock
 

Detailed Description

Definition at line 49 of file getlineWithTimeout.h.

Constructor & Destructor Documentation

◆ nocopyLine()

template<typename durationType >
getlineWithTimeout::nocopyLine::nocopyLine ( getlineWithTimeout aLineGetter,
durationType  timeout 
)
inline

Definition at line 53 of file getlineWithTimeout.h.

53  :
54  lineGetter(aLineGetter), lock(lineGetter.lineMutex) {
55  while (lineGetter.waitingForData) {
56  if (lineGetter.cv.wait_for(lock, timeout) == std::cv_status::timeout) {
57  return;
58  }
59  }
60  return;
61  }

References getlineWithTimeout::cv, lineGetter, lock, and getlineWithTimeout::waitingForData.

◆ ~nocopyLine()

getlineWithTimeout::nocopyLine::~nocopyLine ( )
inline

Definition at line 68 of file getlineWithTimeout.h.

68  {
70  lineGetter.cv.notify_all();
71  }

References getlineWithTimeout::cv, lineGetter, and getlineWithTimeout::waitingForData.

Member Function Documentation

◆ line()

std::string& getlineWithTimeout::nocopyLine::line ( )
inline

Definition at line 65 of file getlineWithTimeout.h.

65  {
66  return lineGetter.line;
67  }

References getlineWithTimeout::line, and lineGetter.

Referenced by followJsonRequestProvider::followStream().

Here is the caller graph for this function:

◆ timedOut()

bool getlineWithTimeout::nocopyLine::timedOut ( ) const
inline

Definition at line 62 of file getlineWithTimeout.h.

62  {
64  }

References lineGetter, and getlineWithTimeout::waitingForData.

Referenced by followJsonRequestProvider::followStream().

Here is the caller graph for this function:

Member Data Documentation

◆ lineGetter

getlineWithTimeout& getlineWithTimeout::nocopyLine::lineGetter
private

Definition at line 50 of file getlineWithTimeout.h.

Referenced by line(), nocopyLine(), timedOut(), and ~nocopyLine().

◆ lock

std::unique_lock<decltype(getlineWithTimeout::lineMutex)> getlineWithTimeout::nocopyLine::lock
private

Definition at line 51 of file getlineWithTimeout.h.

Referenced by nocopyLine().


The documentation for this class was generated from the following file:
getlineWithTimeout::lineMutex
std::mutex lineMutex
Definition: getlineWithTimeout.h:14
getlineWithTimeout::cv
std::condition_variable cv
Definition: getlineWithTimeout.h:15
getlineWithTimeout::nocopyLine::lock
std::unique_lock< decltype(getlineWithTimeout::lineMutex)> lock
Definition: getlineWithTimeout.h:51
getlineWithTimeout::waitingForData
bool waitingForData
Definition: getlineWithTimeout.h:12
getlineWithTimeout::nocopyLine::lineGetter
getlineWithTimeout & lineGetter
Definition: getlineWithTimeout.h:50
getlineWithTimeout::line
std::string line
Definition: getlineWithTimeout.h:13