w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Retro::RlinkServer Class Reference

FIXME_docs. More...

#include <RlinkServer.hpp>

Collaboration diagram for Retro::RlinkServer:
[legend]

Classes

class  AttnArgs
 FIXME_docs. More...
 
class  AttnDsc
 FIXME_docs. More...
 
class  AttnId
 FIXME_docs. More...
 

Public Types

enum  stats {
  kStatNEloopWait = 0 , kStatNEloopPoll , kStatNWakeupEvt , kStatNRlinkEvt ,
  kStatNAttnHdl , kStatNAttnNoti , kStatNAttnHarv , kStatNAttn00 ,
  kStatNAttn01 , kStatNAttn02 , kStatNAttn03 , kStatNAttn04 ,
  kStatNAttn05 , kStatNAttn06 , kStatNAttn07 , kStatNAttn08 ,
  kStatNAttn09 , kStatNAttn10 , kStatNAttn11 , kStatNAttn12 ,
  kStatNAttn13 , kStatNAttn14 , kStatNAttn15 , kDimStat
}
 
typedef ReventLoop::pollhdl_t pollhdl_t
 
typedef std::function< int(AttnArgs &)> attnhdl_t
 
typedef std::function< int()> actnhdl_t
 

Public Member Functions

 RlinkServer ()
 Default constructor.
 
virtual ~RlinkServer ()
 Destructor.
 
 RlinkServer (const RlinkServer &)=delete
 
RlinkServeroperator= (const RlinkServer &)=delete
 
void SetConnect (const std::shared_ptr< RlinkConnect > &spconn)
 FIXME_docs.
 
const std::shared_ptr< RlinkConnect > & ConnectSPtr () const
 FIXME_docs.
 
RlinkConnectConnect () const
 FIXME_docs.
 
RlogFileLogFile () const
 FIXME_docs.
 
RlinkContextContext ()
 FIXME_docs.
 
bool Exec (RlinkCommandList &clist, RerrMsg &emsg)
 FIXME_docs.
 
void Exec (RlinkCommandList &clist)
 FIXME_docs.
 
void AddAttnHandler (attnhdl_t &&attnhdl, uint16_t mask, void *cdata=nullptr)
 FIXME_docs.
 
void RemoveAttnHandler (uint16_t mask, void *cdata=nullptr)
 FIXME_docs.
 
void GetAttnInfo (AttnArgs &args, RlinkCommandList &clist)
 FIXME_docs.
 
void GetAttnInfo (AttnArgs &args)
 FIXME_docs.
 
void QueueAction (actnhdl_t &&actnhdl)
 FIXME_docs.
 
void AddPollHandler (pollhdl_t &&pollhdl, int fd, short events=POLLIN)
 FIXME_docs.
 
bool TestPollHandler (int fd, short events=POLLIN)
 FIXME_docs.
 
void RemovePollHandler (int fd, short events, bool nothrow=false)
 FIXME_docs.
 
void RemovePollHandler (int fd)
 FIXME_docs.
 
void Start ()
 FIXME_docs.
 
void Stop ()
 FIXME_docs.
 
void Resume ()
 FIXME_docs.
 
void Wakeup ()
 FIXME_docs.
 
void SignalAttnNotify (uint16_t apat)
 FIXME_docs.
 
bool IsActive () const
 Indicates whether server is active.
 
bool IsActiveInside () const
 Indicates whether server is active and caller is inside server thread.
 
bool IsActiveOutside () const
 Indicates whether server is active and caller is outside server thread.
 
void SetTraceLevel (uint32_t level)
 FIXME_docs.
 
uint32_t TraceLevel () const
 FIXME_docs.
 
RstatsStats ()
 FIXME_docs.
 
void Print (std::ostream &os) const
 FIXME_docs.
 
void Dump (std::ostream &os, int ind=0, const char *text=0, int detail=0) const
 FIXME_docs.
 

Protected Member Functions

void StartOrResume (bool resume)
 FIXME_docs.
 
bool AttnPending () const
 FIXME_docs.
 
bool ActnPending () const
 FIXME_docs.
 
void CallAttnHandler ()
 FIXME_docs.
 
void CallActnHandler ()
 FIXME_docs.
 
int WakeupHandler (const pollfd &pfd)
 FIXME_docs.
 
int RlinkHandler (const pollfd &pfd)
 FIXME_docs.
 

Protected Attributes

std::shared_ptr< RlinkConnectfspConn
 
RlinkContext fContext
 default server context
 
std::vector< AttnDscfAttnDsc
 
std::list< actnhdl_tfActnList
 
ReventFd fWakeupEvent
 
RlinkServerEventLoop fELoop
 
std::thread fServerThread
 
uint16_t fAttnPatt
 current attn pattern
 
uint16_t fAttnNotiPatt
 attn notifier pattern
 
uint32_t fTraceLevel
 trace level
 
Rstats fStats
 statistics
 

Friends

class RlinkServerEventLoop
 

Detailed Description

FIXME_docs.

Definition at line 48 of file RlinkServer.hpp.

Member Typedef Documentation

◆ pollhdl_t

◆ attnhdl_t

typedef std::function<int(AttnArgs&)> Retro::RlinkServer::attnhdl_t

Definition at line 61 of file RlinkServer.hpp.

◆ actnhdl_t

typedef std::function<int()> Retro::RlinkServer::actnhdl_t

Definition at line 62 of file RlinkServer.hpp.

Member Enumeration Documentation

◆ stats

Enumerator
kStatNEloopWait 

event loop turns (wait)

kStatNEloopPoll 

event loop turns (poll)

kStatNWakeupEvt 

Wakeup events.

kStatNRlinkEvt 

Rlink data events.

kStatNAttnHdl 

Attn handler calls.

kStatNAttnNoti 

Attn notifies processed.

kStatNAttnHarv 

Attn handler restarts.

kStatNAttn00 

Attn bit 0 set.

kStatNAttn01 

Attn bit 1 set.

kStatNAttn02 

Attn bit 2 set.

kStatNAttn03 

Attn bit 3 set.

kStatNAttn04 

Attn bit 4 set.

kStatNAttn05 

Attn bit 5 set.

kStatNAttn06 

Attn bit 6 set.

kStatNAttn07 

Attn bit 7 set.

kStatNAttn08 

Attn bit 8 set.

kStatNAttn09 

Attn bit 9 set.

kStatNAttn10 

Attn bit 10 set.

kStatNAttn11 

Attn bit 11 set.

kStatNAttn12 

Attn bit 12 set.

kStatNAttn13 

Attn bit 13 set.

kStatNAttn14 

Attn bit 14 set.

kStatNAttn15 

Attn bit 15 set.

kDimStat 

Definition at line 113 of file RlinkServer.hpp.

Constructor & Destructor Documentation

◆ RlinkServer() [1/2]

◆ ~RlinkServer()

Retro::RlinkServer::~RlinkServer ( )
virtual

Destructor.

Definition at line 109 of file RlinkServer.cpp.

References Retro::Rtools::Catch2Cerr(), fspConn, and Stop().

◆ RlinkServer() [2/2]

Retro::RlinkServer::RlinkServer ( const RlinkServer )
delete

Member Function Documentation

◆ operator=()

RlinkServer & Retro::RlinkServer::operator= ( const RlinkServer )
delete

◆ SetConnect()

void Retro::RlinkServer::SetConnect ( const std::shared_ptr< RlinkConnect > &  spconn)

FIXME_docs.

Definition at line 118 of file RlinkServer.cpp.

References fELoop, fspConn, and Retro::ReventLoop::SetLogFile().

Referenced by Retro::RtclRlinkServer::ClassCmdConfig().

◆ ConnectSPtr()

const std::shared_ptr< RlinkConnect > & Retro::RlinkServer::ConnectSPtr ( ) const
inline

FIXME_docs.

Definition at line 28 of file RlinkServer.ipp.

References fspConn.

◆ Connect()

RlinkConnect & Retro::RlinkServer::Connect ( ) const
inline

FIXME_docs.

Definition at line 36 of file RlinkServer.ipp.

References fspConn.

Referenced by Exec(), and StartOrResume().

◆ LogFile()

RlogFile & Retro::RlinkServer::LogFile ( ) const
inline

FIXME_docs.

Definition at line 44 of file RlinkServer.ipp.

References fspConn.

Referenced by CallAttnHandler(), SignalAttnNotify(), and StartOrResume().

◆ Context()

RlinkContext & Retro::RlinkServer::Context ( )
inline

FIXME_docs.

Definition at line 52 of file RlinkServer.ipp.

References fContext.

Referenced by Retro::RtclRlinkServer::RtclRlinkServer().

◆ Exec() [1/2]

◆ Exec() [2/2]

void Retro::RlinkServer::Exec ( RlinkCommandList clist)
inline

FIXME_docs.

Definition at line 68 of file RlinkServer.ipp.

References Connect(), Retro::RlinkConnect::Exec(), and fContext.

◆ AddAttnHandler()

◆ RemoveAttnHandler()

void Retro::RlinkServer::RemoveAttnHandler ( uint16_t  mask,
void *  cdata = nullptr 
)

FIXME_docs.

Definition at line 187 of file RlinkServer.cpp.

References fAttnDsc, and fspConn.

Referenced by Retro::RtclAttnShuttle::Remove().

◆ GetAttnInfo() [1/2]

◆ GetAttnInfo() [2/2]

void Retro::RlinkServer::GetAttnInfo ( AttnArgs args)

FIXME_docs.

Definition at line 176 of file RlinkServer.cpp.

References Retro::RlinkCommandList::AddAttn(), and GetAttnInfo().

◆ QueueAction()

◆ AddPollHandler()

◆ TestPollHandler()

bool Retro::RlinkServer::TestPollHandler ( int  fd,
short  events = POLLIN 
)

FIXME_docs.

Definition at line 228 of file RlinkServer.cpp.

References fELoop, fspConn, and Retro::ReventLoop::TestPollHandler().

◆ RemovePollHandler() [1/2]

void Retro::RlinkServer::RemovePollHandler ( int  fd,
short  events,
bool  nothrow = false 
)

◆ RemovePollHandler() [2/2]

void Retro::RlinkServer::RemovePollHandler ( int  fd)

FIXME_docs.

Definition at line 248 of file RlinkServer.cpp.

References fELoop, fspConn, IsActiveOutside(), Retro::ReventLoop::RemovePollHandler(), and Wakeup().

◆ Start()

void Retro::RlinkServer::Start ( )

FIXME_docs.

Definition at line 259 of file RlinkServer.cpp.

References StartOrResume().

Referenced by Retro::RtclRlinkServer::M_server(), and Retro::Rw11::Start().

◆ Stop()

void Retro::RlinkServer::Stop ( )

◆ Resume()

void Retro::RlinkServer::Resume ( )

FIXME_docs.

Definition at line 280 of file RlinkServer.cpp.

References StartOrResume().

Referenced by Retro::RtclRlinkServer::M_server().

◆ Wakeup()

void Retro::RlinkServer::Wakeup ( )

FIXME_docs.

Definition at line 289 of file RlinkServer.cpp.

References fWakeupEvent, and Retro::ReventFd::Signal().

Referenced by AddPollHandler(), QueueAction(), RemovePollHandler(), SignalAttnNotify(), and Stop().

◆ SignalAttnNotify()

void Retro::RlinkServer::SignalAttnNotify ( uint16_t  apat)

FIXME_docs.

Definition at line 298 of file RlinkServer.cpp.

References fAttnNotiPatt, LogFile(), and Wakeup().

Referenced by Retro::RlinkConnect::ProcessAttnNotify().

◆ IsActive()

bool Retro::RlinkServer::IsActive ( ) const

Indicates whether server is active.

Returns
true if server active.

Definition at line 318 of file RlinkServer.cpp.

References fServerThread.

Referenced by IsActiveInside(), IsActiveOutside(), Retro::RlinkConnect::ServerActive(), StartOrResume(), and Stop().

◆ IsActiveInside()

bool Retro::RlinkServer::IsActiveInside ( ) const

Indicates whether server is active and caller is inside server thread.

Returns
true if server active and method is called from server thread.

Definition at line 329 of file RlinkServer.cpp.

References fServerThread, and IsActive().

Referenced by Retro::RlinkConnect::ServerActiveInside().

◆ IsActiveOutside()

bool Retro::RlinkServer::IsActiveOutside ( ) const

Indicates whether server is active and caller is outside server thread.

Returns
true if server active and method is called from a thread other than the server thread.

Definition at line 341 of file RlinkServer.cpp.

References fServerThread, and IsActive().

Referenced by AddPollHandler(), QueueAction(), RemovePollHandler(), and Retro::RlinkConnect::ServerActiveOutside().

◆ SetTraceLevel()

void Retro::RlinkServer::SetTraceLevel ( uint32_t  level)

FIXME_docs.

Definition at line 349 of file RlinkServer.cpp.

References fELoop, fTraceLevel, and Retro::ReventLoop::SetTraceLevel().

Referenced by Retro::RtclRlinkServer::RtclRlinkServer().

◆ TraceLevel()

uint32_t Retro::RlinkServer::TraceLevel ( ) const
inline

FIXME_docs.

Definition at line 77 of file RlinkServer.ipp.

References fTraceLevel.

Referenced by Retro::RtclRlinkServer::RtclRlinkServer().

◆ Stats()

Rstats & Retro::RlinkServer::Stats ( )
inline

FIXME_docs.

Definition at line 85 of file RlinkServer.ipp.

References fStats.

◆ Print()

void Retro::RlinkServer::Print ( std::ostream &  os) const

FIXME_docs.

Definition at line 359 of file RlinkServer.cpp.

Referenced by Retro::RtclRlinkServer::M_print().

◆ Dump()

void Retro::RlinkServer::Dump ( std::ostream &  os,
int  ind = 0,
const char *  text = 0,
int  detail = 0 
) const

◆ StartOrResume()

◆ AttnPending()

bool Retro::RlinkServer::AttnPending ( ) const
inlineprotected

FIXME_docs.

Definition at line 93 of file RlinkServer.ipp.

References fAttnNotiPatt, and fAttnPatt.

Referenced by Retro::RlinkServerEventLoop::EventLoop().

◆ ActnPending()

bool Retro::RlinkServer::ActnPending ( ) const
inlineprotected

FIXME_docs.

Definition at line 101 of file RlinkServer.ipp.

References fActnList.

Referenced by CallActnHandler(), and Retro::RlinkServerEventLoop::EventLoop().

◆ CallAttnHandler()

◆ CallActnHandler()

void Retro::RlinkServer::CallActnHandler ( )
protected

FIXME_docs.

Definition at line 523 of file RlinkServer.cpp.

References ActnPending(), fActnList, and fspConn.

Referenced by Retro::RlinkServerEventLoop::EventLoop().

◆ WakeupHandler()

int Retro::RlinkServer::WakeupHandler ( const pollfd &  pfd)
protected

FIXME_docs.

Definition at line 545 of file RlinkServer.cpp.

References fStats, fWakeupEvent, Retro::Rstats::Inc(), kStatNWakeupEvt, and Retro::ReventFd::Wait().

Referenced by RlinkServer().

◆ RlinkHandler()

int Retro::RlinkServer::RlinkHandler ( const pollfd &  pfd)
protected

FIXME_docs.

Definition at line 559 of file RlinkServer.cpp.

References fspConn, fStats, Retro::Rstats::Inc(), and kStatNRlinkEvt.

Referenced by StartOrResume().

Friends And Related Function Documentation

◆ RlinkServerEventLoop

friend class RlinkServerEventLoop
friend

Definition at line 140 of file RlinkServer.hpp.

Member Data Documentation

◆ fspConn

◆ fContext

RlinkContext Retro::RlinkServer::fContext
protected

default server context

Definition at line 168 of file RlinkServer.hpp.

Referenced by Context(), Exec(), and RlinkServer().

◆ fAttnDsc

std::vector<AttnDsc> Retro::RlinkServer::fAttnDsc
protected

Definition at line 169 of file RlinkServer.hpp.

Referenced by AddAttnHandler(), CallAttnHandler(), Dump(), and RemoveAttnHandler().

◆ fActnList

std::list<actnhdl_t> Retro::RlinkServer::fActnList
protected

Definition at line 170 of file RlinkServer.hpp.

Referenced by ActnPending(), CallActnHandler(), Dump(), and QueueAction().

◆ fWakeupEvent

ReventFd Retro::RlinkServer::fWakeupEvent
protected

Definition at line 171 of file RlinkServer.hpp.

Referenced by Dump(), RlinkServer(), Wakeup(), and WakeupHandler().

◆ fELoop

RlinkServerEventLoop Retro::RlinkServer::fELoop
protected

◆ fServerThread

std::thread Retro::RlinkServer::fServerThread
protected

Definition at line 173 of file RlinkServer.hpp.

Referenced by Dump(), IsActive(), IsActiveInside(), IsActiveOutside(), StartOrResume(), and Stop().

◆ fAttnPatt

uint16_t Retro::RlinkServer::fAttnPatt
protected

current attn pattern

Definition at line 174 of file RlinkServer.hpp.

Referenced by AttnPending(), CallAttnHandler(), and Dump().

◆ fAttnNotiPatt

uint16_t Retro::RlinkServer::fAttnNotiPatt
protected

attn notifier pattern

Definition at line 175 of file RlinkServer.hpp.

Referenced by AttnPending(), CallAttnHandler(), Dump(), and SignalAttnNotify().

◆ fTraceLevel

uint32_t Retro::RlinkServer::fTraceLevel
protected

trace level

Definition at line 176 of file RlinkServer.hpp.

Referenced by CallAttnHandler(), SetTraceLevel(), and TraceLevel().

◆ fStats

Rstats Retro::RlinkServer::fStats
protected

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