Matrix Science header

ms_cronoptions.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_cronoptions.hpp                                                   #
00004 # 'msparser' toolkit                                                         #
00005 # Represents parameters from cron-section of 'mascot.dat' configuration file #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_cronoptions.hpp         $ #
00012 #     $Author: villek@matrixscience.com $ #
00013 #       $Date: 2018-07-30 16:23:53 +0100 $ #
00014 #   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_CRONOPTIONS_HPP
00020 #define MS_CRONOPTIONS_HPP
00021 
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 
00027 namespace matrix_science {
00033 
00034 
00037     class MS_MASCOTRESFILE_API ms_cronjob
00038     {
00039         friend class ms_datfile;
00040         friend class ms_cronoptions;
00041 
00042     public:
00044         ms_cronjob();
00045 
00047         ms_cronjob(const ms_cronjob& src);
00048 
00050         ~ms_cronjob();
00051 
00053         void defaultValues();
00054 
00056         void copyFrom(const ms_cronjob* right);
00057 
00058 #ifndef SWIG
00059 
00060         ms_cronjob& operator=(const ms_cronjob& right);
00061 #endif
00062 
00063         bool isEnabled() const;
00064 
00066         void setEnabled(const bool enabled);
00067 
00069         bool isMinute(const int min) const;
00070 
00072         void setMinute(const int min, const bool value);
00073 
00075         bool isHour(const int hour) const;
00076 
00078         void setHour(const int hour, const bool value);
00079 
00081         bool isDayOfMonth(const int day) const;
00082 
00084         void setDayOfMonth(const int day, const bool value);
00085 
00087         bool isMonthOfYear(const int month) const;
00088 
00090         void setMonthOfYear(const int month, const bool value);
00091 
00093         bool isDayOfWeek(const int day) const;
00094 
00096         void setDayOfWeek(const int day, const bool value);
00097 
00099         std::string getCommandStr() const;
00100 
00102         void setCommandStr(const char* str);
00103 
00104         // used internally
00105         std::string getStringValue() const;
00106 
00107     private:
00108         bool  enabled_;               /* If false, then a #[space] at start of line */
00109         bool  minute_[60];            /* index of 0-59 - Value of true means do it  */
00110         bool  hour_[24];              /* index of 0-23 - Value of true means do it  */
00111         bool  dayOfMonth_[32];        /* index of 1-31 - Value of true means do it  */
00112         bool  monthOfYear_[13];       /* index of 1-12 - Value of true means do it  */
00113         bool  dayOfWeek_[7];          /* index of  0-6 (0 = Sunday)                 */
00114         std::string szCommand_;
00115 
00116         void setCustomString();
00117         std::string customString_;
00118     }; // class ms_cronjob
00119 
00121 
00149     class MS_MASCOTRESFILE_API ms_cronoptions: public ms_customproperty
00150     {
00151         friend class ms_datfile;
00152     public:
00153 
00155         ms_cronoptions();
00156 
00158         ms_cronoptions(const ms_cronoptions& src);
00159 
00161         ~ms_cronoptions();
00162 
00164         void defaultValues();
00165 
00167         void copyFrom(const ms_cronoptions* right);
00168 
00169 #ifndef SWIG
00170 
00171         ms_cronoptions& operator=(const ms_cronoptions& right);
00172 #endif
00173 
00174         bool isSectionAvailable() const;
00175 
00177         void setSectionAvailable(const bool value);
00178 
00180         bool isCronEnabled() const;
00181 
00183         void setCronEnabled(const bool value);
00184 
00186         int getNumberOfCronJobs() const;
00187 
00189         const ms_cronjob getCronJob(const int idx) const;
00190 
00192         bool setCronJob(const int idx, const ms_cronjob job);
00193 
00195         bool deleteCronJob(const int idx);
00196 
00198         void clearCronJobs();
00199 
00201         void appendCronJob(const ms_cronjob* job);
00202 
00204         int getLoggingLevel() const;
00205 
00207         bool setLoggingLevel(const int level);
00208 
00210         std::string getLogFileName() const;
00211 
00213         bool setLogFileName(const std::string & fileName);
00214 
00215 
00216 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00217 #include "suppress_ms_customproperty.hpp"
00218 #endif
00219 
00220     private:
00221         int findProperty(const ms_cronjob & job) const;
00222         bool getPropertyNameValue(const ms_cronjob & job, std::string & name, std::string & value) const;
00223         bool                        sectionAvailable_;
00224         bool                        cronEnabled_;
00225         std::vector< ms_cronjob  >  cronJobArray_;
00226         int                         loggingLevel_;
00227         std::string                 logFileName_;
00228     }; // ms_cronoptions // end of config_group
00230 } // namespace matrix_science
00231 
00232 #endif // MS_CRONOPTIONS_HPP
00233 
00234 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29