Matrix Science header

ms_umod_configfile.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_umod_configfile.hpp                                               #
00004 # 'msparser' toolkit                                                         #
00005 # Represents unimod.xml file                                                 #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 # $Archive:: /Mowse/ms_mascotresfile/include/ms_umod_configfile.hpp                 $ #
00012 # $Author: francoisr $ #
00013 # $Date: 2017/03/23 11:17:08 $ #
00014 # $Revision: 1.21 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_UMOD_CONFIGFILE_HPP
00020 #define MS_UMOD_CONFIGFILE_HPP
00021 
00022 #ifdef _WIN32
00023 #pragma warning(disable:4251)   // Don't want all classes to be exported
00024 #pragma warning(disable:4786)   // Debug symbols too long
00025 #   ifndef _MATRIX_USE_STATIC_LIB
00026 #       ifdef MS_MASCOTRESFILE_EXPORTS
00027 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00028 #       else
00029 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00030 #       endif
00031 #   else
00032 #       define MS_MASCOTRESFILE_API
00033 #   endif
00034 #else
00035 #   define MS_MASCOTRESFILE_API
00036 #endif
00037 
00038 // for the sake of #include <string>
00039 #ifdef __ALPHA_UNIX__
00040 #include <ctype.h>
00041 #endif
00042 #include <string>
00043 #include <vector>
00044 
00045 
00046 namespace matrix_science {
00047 
00048     class ms_umod_element; // forward declaration
00049     class ms_umod_modification; // forward declaration
00050     class ms_umod_aminoacid; // forward declaration
00051     class ms_umod_modbrick; // forward declaration
00052     class ms_session;
00053 
00059 
00060 
00072     class MS_MASCOTRESFILE_API ms_umod_configfile: public ms_errors
00073     {
00074     public:
00076 
00083             enum MODFILE_FLAGS 
00084             { 
00085                 MODFILE_FLAGS_EMPTY   = 0x00000000, 
00086                 MODFILE_FLAGS_REGULAR = 0x00000001, 
00087                 MODFILE_FLAGS_HIDDEN  = 0x00000002, 
00088                 MODFILE_FLAGS_AASUBST = 0x00000004, 
00089                 MODFILE_FLAGS_ALL     = 0x7FFFFFFF  
00090             };
00091 
00093         ms_umod_configfile();
00094 
00096         ms_umod_configfile(const char* fileName, const char* schemaFileName, 
00097             const ms_connection_settings * cs = 0, bool useSchema = true);
00098 
00100         ms_umod_configfile(const ms_umod_configfile& right);
00101 
00103         virtual ~ms_umod_configfile();
00104 
00105 #ifndef SWIG
00106 
00107         ms_umod_configfile& operator=(const ms_umod_configfile& right);
00108 #endif
00109 
00110         void copyFrom(const ms_umod_configfile* right);
00111 
00113         virtual void defaultValues();
00114 
00116         void updateMasses();
00117 
00118 
00120         std::string getFileName() const;
00121 
00123         void setFileName(const char* filename);
00124 
00125 
00127         void setSchemaFileName(const char* name);
00128 
00130         std::string getSchemaFileName() const;
00131 
00133         static std::string getDefaultSchemaFileName();
00134 
00136         void setConnectionSettings(const ms_connection_settings & cs);
00137 
00139         ms_connection_settings getConnectionSettings() const;
00140 
00141 
00143         void read_file();
00144 
00146         void save_file();
00147 
00149         void applyVisibility( const ms_session *session);
00150 
00152         void applyVisibility(const std::vector<int> & groupIds);
00153 
00155         void read_buffer(const char* buffer);
00156 
00158         std::string save_buffer(bool validateAgainstSchema = true);
00159 
00160 
00162         std::string validateDocument() const;
00163 
00164 
00166         int getNumberOfElements() const;
00167 
00169         void clearElements();
00170 
00172         void appendElement(const ms_umod_element *elem);
00173 
00175         const ms_umod_element * getElementByNumber(const int idx) const;
00176 
00178         const ms_umod_element * getElementByName(const char *name) const;
00179 
00181         bool updateElementByNumber(const int idx, const ms_umod_element* element);
00182 
00184         bool updateElementByName(const char *name, const ms_umod_element* element);
00185 
00187         bool deleteElementByNumber(const int idx);
00188 
00190         bool deleteElementByName(const char *name);
00191 
00192 
00194         std::vector< std::string > getModFileList(const unsigned int flags = MODFILE_FLAGS_ALL) const;
00195 
00197         int findModFileName(const char * modFileName) const;
00198 
00200         int findModification(const char* modName) const;
00201 
00202 
00204         int getNumberOfModifications() const;
00205 
00207         void clearModifications();
00208 
00210         void appendModification(const ms_umod_modification *mod);
00211 
00213         const ms_umod_modification * getModificationByNumber(const int idx) const;
00214 
00216         const ms_umod_modification * getModificationByName(const char *name) const;
00217 
00219         bool updateModificationByNumber(const int idx, const ms_umod_modification *mod);
00220 
00222         bool updateModificationByName(const char *name, const ms_umod_modification *mod);
00223 
00225         bool deleteModificationByNumber(const int idx);
00226 
00228         bool deleteModificationByName(const char *name);
00229 
00230 
00232         int getNumberOfAminoAcids() const;
00233 
00235         void clearAminoAcids();
00236 
00238         void appendAminoAcid(const ms_umod_aminoacid *aa);
00239 
00241         const ms_umod_aminoacid * getAminoAcidByNumber(const int idx) const;
00242 
00244         const ms_umod_aminoacid * getAminoAcidByName(const char *name) const;
00245 
00247         bool updateAminoAcidByNumber(const int idx, const ms_umod_aminoacid *aa);
00248 
00250         bool updateAminoAcidByName(const char *name, const ms_umod_aminoacid *aa);
00251 
00253         bool deleteAminoAcidByNumber(const int idx);
00254 
00256         bool deleteAminoAcidByName(const char *name);
00257 
00258 
00260         int getNumberOfModBricks() const;
00261 
00263         void clearModBricks();
00264 
00266         void appendModBrick(const ms_umod_modbrick *brick);
00267 
00269         const ms_umod_modbrick * getModBrickByNumber(const int idx) const;
00270 
00272         const ms_umod_modbrick * getModBrickByName(const char *name) const;
00273 
00275         bool updateModBrickByNumber(const int idx, const ms_umod_modbrick *brick);
00276 
00278         bool updateModBrickByName(const char *name, const ms_umod_modbrick *brick);
00279 
00281         bool deleteModBrickByNumber(const int idx);
00282 
00284         bool deleteModBrickByName(const char *name);
00285 
00287         std::string getMajorVersion() const;
00288 
00290         std::string getMinorVersion() const;
00291     private:
00292 
00293         void applyVisibilityHelper();
00294 
00295         std::string             m_fileName;
00296         std::string             m_schemaFileName;
00297         ms_connection_settings  m_cs;
00298 
00299         typedef std::vector< ms_umod_element* > element_vector;
00300         element_vector          m_elements;
00301 
00302         typedef std::vector< ms_umod_modification* > modification_vector;
00303         modification_vector     m_modifications;
00304 
00305         typedef std::vector< ms_umod_aminoacid* > aminoacid_vector;
00306         aminoacid_vector        m_aminoacids;
00307 
00308         typedef std::vector< ms_umod_modbrick* > modbrick_vector;
00309         modbrick_vector         m_modbricks;
00310 
00311         std::string m_majorVersion;
00312         std::string m_minorVersion;
00313 
00314         std::string m_encodingName;
00315         bool m_useSchema;
00316     }; // class ms_umod_configfile
00317  // end of config_group
00319 
00320 } // namespace matrix_science
00321 
00322 #endif // MS_UMOD_CONFIGFILE_HPP
00323 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51