MIDAS
Loading...
Searching...
No Matches
WriterFtp Class Reference
Inheritance diagram for WriterFtp:
Collaboration diagram for WriterFtp:

Public Member Functions

 WriterFtp (LOG_CHN *log_chn)
 
 ~WriterFtp ()
 
int wr_open (LOG_CHN *log_chn, int run_number)
 
int wr_write (LOG_CHN *log_chn, const void *data, const int size)
 
int wr_close (LOG_CHN *log_chn, int run_number)
 
std::string wr_get_file_ext ()
 
std::string wr_get_chain ()
 
- Public Member Functions inherited from WriterInterface
 WriterInterface ()
 
virtual ~WriterInterface ()
 

Private Attributes

FTP_CONfFtp
 

Additional Inherited Members

- Public Attributes inherited from WriterInterface
bool fTrace
 
double fBytesIn
 
double fBytesOut
 

Detailed Description

Definition at line 2911 of file mlogger.cxx.

Constructor & Destructor Documentation

◆ WriterFtp()

WriterFtp::WriterFtp ( LOG_CHN log_chn)
inline

Definition at line 2914 of file mlogger.cxx.

2915 {
2916 if (fTrace)
2917 printf("WriterFtp: path [%s]\n", log_chn->path.c_str());
2918
2919 fFtp = NULL;
2920 }
FTP_CON * fFtp
Definition mlogger.cxx:3008
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ ~WriterFtp()

WriterFtp::~WriterFtp ( )
inline

Definition at line 2922 of file mlogger.cxx.

2923 {
2924 if (fTrace)
2925 printf("WriterFtp: destructor\n");
2926
2927 if (fFtp) {
2928 ftp_bye(fFtp);
2929 fFtp = NULL;
2930 }
2931 }
int ftp_bye(FTP_CON *con)
Definition ftplib.cxx:422
Here is the call graph for this function:

Member Function Documentation

◆ wr_close()

int WriterFtp::wr_close ( LOG_CHN log_chn,
int  run_number 
)
inlinevirtual

Implements WriterInterface.

Definition at line 2981 of file mlogger.cxx.

2982 {
2983 if (fTrace)
2984 printf("WriterFtp: close path [%s]\n", log_chn->path.c_str());
2985
2986 assert(fFtp != NULL);
2987
2988 ftp_close(fFtp);
2989 ftp_bye(fFtp);
2990 fFtp = NULL;
2991
2992 log_chn->handle = 0;
2993
2994 return SUCCESS;
2995 }
int ftp_close(FTP_CON *con)
Definition ftplib.cxx:334
#define SUCCESS
Definition mcstd.h:54
Here is the call graph for this function:

◆ wr_get_chain()

std::string WriterFtp::wr_get_chain ( )
inlinevirtual

Implements WriterInterface.

Definition at line 3002 of file mlogger.cxx.

3003 {
3004 return "FTP";
3005 }

◆ wr_get_file_ext()

std::string WriterFtp::wr_get_file_ext ( )
inlinevirtual

Reimplemented from WriterInterface.

Definition at line 2997 of file mlogger.cxx.

2998 {
2999 return "";
3000 }

◆ wr_open()

int WriterFtp::wr_open ( LOG_CHN log_chn,
int  run_number 
)
inlinevirtual

Implements WriterInterface.

Definition at line 2933 of file mlogger.cxx.

2934 {
2935 fBytesIn = 0;
2936 fBytesOut = 0;
2937
2938 if (fTrace)
2939 printf("WriterFtp: open path [%s]\n", log_chn->path.c_str());
2940
2941 assert(fFtp == NULL);
2942
2943 int status = ftp_open(log_chn->path.c_str(), &fFtp);
2944 if (status != SS_SUCCESS || fFtp == NULL) {
2945 cm_msg(MERROR, "WriterFtp::wr_open", "Cannot open FTP connection \'%s\', ftp_open() status %d, errno %d (%s)", log_chn->path.c_str(), status, errno, strerror(errno));
2946 return SS_FILE_ERROR;
2947 }
2948
2949 log_chn->handle = 9999;
2950
2951 return SUCCESS;
2952 }
#define SS_SUCCESS
Definition midas.h:663
#define SS_FILE_ERROR
Definition midas.h:669
#define MERROR
Definition midas.h:559
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
INT ftp_open(const char *xdestination, FTP_CON **con)
Definition mlogger.cxx:2828
DWORD status
Definition odbhist.cxx:39
Here is the call graph for this function:

◆ wr_write()

int WriterFtp::wr_write ( LOG_CHN log_chn,
const void data,
const int  size 
)
inlinevirtual

Implements WriterInterface.

Definition at line 2954 of file mlogger.cxx.

2955 {
2956 if (fTrace)
2957 printf("WriterFtp: write path [%s], size %d\n", log_chn->path.c_str(), size);
2958
2959 if (size == 0)
2960 return SUCCESS;
2961
2962 if (fFtp == NULL) {
2963 return SS_FILE_ERROR;
2964 }
2965
2966 fBytesIn += size;
2967
2968 int wr = ftp_send(fFtp->data, (const char*)data, size);
2969
2970 if (wr > 0)
2971 fBytesOut += wr;
2972
2973 if (wr != size) {
2974 cm_msg(MERROR, "WriterFtp::wr_write", "Cannot write to FTP connection \'%s\', ftp_send(%d) returned %d, errno %d (%s)", log_chn->path.c_str(), size, wr, errno, strerror(errno));
2975 return SS_FILE_ERROR;
2976 }
2977
2978 return SUCCESS;
2979 }
int ftp_send(int sock, const char *buffer, int n_bytes_to_write)
Definition ftplib.cxx:346
void * data
Definition mana.cxx:268
int data
Definition ftplib.h:27
Here is the call graph for this function:

Member Data Documentation

◆ fFtp

FTP_CON* WriterFtp::fFtp
private

Definition at line 3008 of file mlogger.cxx.


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