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 2915 of file mlogger.cxx.

Constructor & Destructor Documentation

◆ WriterFtp()

WriterFtp::WriterFtp ( LOG_CHN log_chn)
inline

Definition at line 2918 of file mlogger.cxx.

2919 {
2920 if (fTrace)
2921 printf("WriterFtp: path [%s]\n", log_chn->path.c_str());
2922
2923 fFtp = NULL;
2924 }
FTP_CON * fFtp
Definition mlogger.cxx:3012
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 2926 of file mlogger.cxx.

2927 {
2928 if (fTrace)
2929 printf("WriterFtp: destructor\n");
2930
2931 if (fFtp) {
2932 ftp_bye(fFtp);
2933 fFtp = NULL;
2934 }
2935 }
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 2985 of file mlogger.cxx.

2986 {
2987 if (fTrace)
2988 printf("WriterFtp: close path [%s]\n", log_chn->path.c_str());
2989
2990 assert(fFtp != NULL);
2991
2992 ftp_close(fFtp);
2993 ftp_bye(fFtp);
2994 fFtp = NULL;
2995
2996 log_chn->handle = 0;
2997
2998 return SUCCESS;
2999 }
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 3006 of file mlogger.cxx.

3007 {
3008 return "FTP";
3009 }

◆ wr_get_file_ext()

std::string WriterFtp::wr_get_file_ext ( )
inlinevirtual

Reimplemented from WriterInterface.

Definition at line 3001 of file mlogger.cxx.

3002 {
3003 return "";
3004 }

◆ wr_open()

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

Implements WriterInterface.

Definition at line 2937 of file mlogger.cxx.

2938 {
2939 fBytesIn = 0;
2940 fBytesOut = 0;
2941
2942 if (fTrace)
2943 printf("WriterFtp: open path [%s]\n", log_chn->path.c_str());
2944
2945 assert(fFtp == NULL);
2946
2947 int status = ftp_open(log_chn->path.c_str(), &fFtp);
2948 if (status != SS_SUCCESS || fFtp == NULL) {
2949 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));
2950 return SS_FILE_ERROR;
2951 }
2952
2953 log_chn->handle = 9999;
2954
2955 return SUCCESS;
2956 }
#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:929
INT ftp_open(const char *xdestination, FTP_CON **con)
Definition mlogger.cxx:2832
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 2958 of file mlogger.cxx.

2959 {
2960 if (fTrace)
2961 printf("WriterFtp: write path [%s], size %d\n", log_chn->path.c_str(), size);
2962
2963 if (size == 0)
2964 return SUCCESS;
2965
2966 if (fFtp == NULL) {
2967 return SS_FILE_ERROR;
2968 }
2969
2970 fBytesIn += size;
2971
2972 int wr = ftp_send(fFtp->data, (const char*)data, size);
2973
2974 if (wr > 0)
2975 fBytesOut += wr;
2976
2977 if (wr != size) {
2978 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));
2979 return SS_FILE_ERROR;
2980 }
2981
2982 return SUCCESS;
2983 }
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 3012 of file mlogger.cxx.


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