LCOV - code coverage report
Current view: top level - felix-client/src - felix_client_info.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 62 63 98.4 %
Date: 2025-08-12 04:15:35 Functions: 20 20 100.0 %

          Line data    Source code
       1             : #include "felix/felix_client_info.hpp"
       2             : #include "felix/felix_client_exception.hpp"
       3             : 
       4             : #include "clog.h"
       5             : 
       6             : 
       7       22297 : netio_socket_type FelixClientContext::getType(){
       8       22297 :     return mType;
       9             : }
      10             : 
      11        4423 : netio_socket_connection FelixClientContext::getConnectionType(){
      12        4423 :     return mConnection;
      13             : }
      14             : 
      15      200824 : subscribe_state FelixClientContext::getSubscriptionState(){
      16      200824 :     return mSubscribed.load();
      17             : }
      18             : 
      19        2387 : std::unordered_map<std::string, timespec> FelixClientContext::getSubscriptionTimes(){
      20        2387 :     return mSubscriptionTimes;
      21             : }
      22             : 
      23       98968 : SocketWrapper* FelixClientContext::getSocket(){
      24       98968 :     return mSocket;
      25             : }
      26             : 
      27         238 : bool FelixClientContext::getForRegister(){
      28         238 :     return mForRegister;
      29             : }
      30             : 
      31         295 : uint FelixClientContext::getWatermark(){
      32         295 :     return mWatermark;
      33             : }
      34             : 
      35         321 : uint FelixClientContext::getPagesize(){
      36         321 :     return mPagesize;
      37             : }
      38             : 
      39         321 : uint FelixClientContext::getPages(){
      40         321 :     return mPages;
      41             : }
      42             : 
      43       18654 : uint FelixClientContext::getPort(){
      44       18654 :     return mPort;
      45             : }
      46             : 
      47       18654 : std::string FelixClientContext::getIp(){
      48       18654 :     return mIp;
      49             : }
      50             : 
      51         442 : bool FelixClientContext::isTcp() {
      52         442 :     return mTcp;
      53             : }
      54             : 
      55        4263 : void FelixClientContext::setSubscriptionTimes(std::string name, timespec ts){
      56        4263 :     if(name == "subscribe" || name == "subscribe_evloop"){
      57        4263 :         mSubscriptionTimes[name] = ts;
      58             :     }else{
      59           0 :        clog_error("Invalid entry for SubscriptionTime");
      60             :    }
      61        4263 : }
      62             : 
      63        2484 : void FelixClientContext::setSocket(SocketWrapper* s){
      64        2484 :     mSocket = s;
      65        2484 : }
      66             : 
      67        4568 : void FelixClientContext::setInfos(std::string& ip, uint port, uint pages, uint pagesize, uint watermark, bool unbuffered, bool pubsub, bool tcp){
      68        4568 :     mIp = ip;
      69        4568 :     mPort = port;
      70        4568 :     mPages = pages;
      71        4568 :     mPagesize = pagesize;
      72        4568 :     mWatermark = watermark;
      73        4568 :     mType = unbuffered ? UNBUFFERED : BUFFERED;
      74        4568 :     mConnection = pubsub ? PUBSUB : SENDRECV;
      75        4568 :     mTcp = tcp;
      76        4568 : }
      77             : 
      78       10468 : void FelixClientContext::setSubscriptionState(subscribe_state s){
      79       10468 :     if (s == SUB){
      80        4321 :         if (mMultiWaitCtx){
      81        2039 :             mMultiWaitCtx->count++;
      82        2039 :             if(mMultiWaitCtx->count == mMultiWaitCtx->expectedSize){
      83         417 :                 mMultiWaitCtx->allSubscribed.notify_all();
      84             :             }
      85             :         }
      86        4321 :         mSubscribeWait.notify_all();        //Socket changes to subscribe state
      87             :     }
      88       10468 :     mSubscribed = s;
      89       10468 : }
      90             : 
      91          17 : void FelixClientContext::setForRegister(bool r){
      92          17 :     mForRegister = r;
      93          17 : }
      94             : 
      95        1565 : void FelixClientContext::setWaitContext(MultiFidsWaitContext* ctx){
      96        1565 :     mMultiWaitCtx = ctx;
      97        1565 : }
      98             : 
      99        1565 : void FelixClientContext::clearWaitContext(){
     100        1565 :     mMultiWaitCtx = NULL;
     101        1565 : }
     102             : 
     103        2110 : void FelixClientContext::removeSocket(){
     104        2110 :     mSocket = mDummyWrapper.get();
     105        2110 : }

Generated by: LCOV version 1.0