gnSourceQualifier.h Source File

Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# gnSourceQualifier.h

Go to the documentation of this file.

    00001 /////////////////////////////////////////////////////////////////////////////
    00002 // File:            gnSourceQualifier.h
    00003 // Purpose:         Source Qualifier class
    00004 // Description:     Provides an interface for gnBaseQualifier in files.
    00005 // Changes:
    00006 // Version:         libGenome 0.5.1
    00007 // Author:          Aaron Darling
    00008 // Modified by:
    00009 // Copyright:       (c) Aaron Darling
    00010 // Licenses:        See COPYING file for details
    00011 /////////////////////////////////////////////////////////////////////////////
    00012 #ifndef _gnSourceQualifier_h_
    00013 #define _gnSourceQualifier_h_
    00014
    00015 #include "gn/gnDefs.h"
    00016
    00017 #include <string>
    00018 #include "gn/gnBaseQualifier.h"
    00019 #include "gn/gnBaseSource.h"
    00020
    00021 #include <utility>
    00022
    00023 /**
    00024  * gnSourceQualifier is used to store a sequence qualifier which resides
    00025  * in another source.  They are created by gnGBKSource and other sources
    00026  * and placed into a gnFeature.
    00027  */
    00028 class GNDLLEXPORT gnSourceQualifier : public gnBaseQualifier
    00029 {
    00030 public:
    00031         /**
    00032          * Empty constructor.
    00033          */
    00034         gnSourceQualifier();
    00035         /**
    00036          * Constructor, records the location and name of the qualifier in the source.
    00037          * @param source The source which contains the qualifier.
    00038          * @param name The name of the qualifier.
    00039          * @param begin The offset into the source where the qualifier starts.
    00040          * @param length The length of the qualifier.
    00041          */
    00042         gnSourceQualifier( gnBaseSource* source, string& name, uint32 begin, uint32 length );
    00043         /**
    00044          * Copy constructor.
    00045          * @param s The gnSourceQualifier to copy.
    00046          */
    00047         gnSourceQualifier( const gnSourceQualifier& s );
    00048         /**
    00049          * Destructor, frees memory.
    00050          */
    00051         ~gnSourceQualifier();
    00052
    00053         gnSourceQualifier* Clone() const;
    00054
    00055         string GetName() const;
    00056         string GetValue() const;
    00057
    00058         uint32 GetNameLength() const;
    00059         uint32 GetValueLength() const;
    00060
    00061         /**
    00062          * Get the qualifier's start position within the source.
    00063          * @return The qualifier start position.
    00064          */
    00065         uint32 GetValueStart() const;
    00066         /**
    00067          * Get the qualifier's start position and length within the source.
    00068          * @return The qualifier start position and length as a pair.
    00069          */
    00070         pair<uint32, uint32> GetValueLoc() const;
    00071
    00072         /**
    00073          * Set the qualifier's start position within the source.
    00074          * @param start The qualifier start position.
    00075          */
    00076         void SetValueStart(const uint32 start);
    00077         /**
    00078          * Get the qualifier's length within the source.
    00079          * @param length The qualifier length.
    00080          */
    00081         void SetValueLength(const uint32 length);
    00082         /**
    00083          * Set the qualifier's start position and length within the source.
    00084          * @param startLen The qualifier start position and length as a pair.
    00085          */
    00086         void SetValueLoc(const pair<uint32, uint32> startLen);
    00087
    00088 private:
    00089         string m_name;
    00090         uint32 m_start, m_length;
    00091         gnBaseSource *m_source;
    00092 }; //class gnSourceQualifier
    00093
    00094 inline
    00095 gnSourceQualifier* gnSourceQualifier::Clone() const{
    00096         return new gnSourceQualifier(*this);
    00097 }
    00098 inline
    00099 string gnSourceQualifier::GetName() const{
    00100         return m_name;
    00101 }
    00102 inline
    00103 uint32 gnSourceQualifier::GetNameLength() const{
    00104         return m_name.length();
    00105 }
    00106 inline
    00107 uint32 gnSourceQualifier::GetValueStart() const{
    00108         return m_start;
    00109 }
    00110 inline
    00111 uint32 gnSourceQualifier::GetValueLength() const{
    00112         return m_length;
    00113 }
    00114 inline
    00115 pair<uint32, uint32> gnSourceQualifier::GetValueLoc() const{
    00116         pair<uint32, uint32> p;
    00117         p.first = m_start;
    00118         p.second = m_length;
    00119         return p;
    00120 }
    00121 inline
    00122 void gnSourceQualifier::SetValueStart(const uint32 start){
    00123         m_start = start;
    00124 }
    00125 inline
    00126 void gnSourceQualifier::SetValueLength(const uint32 length){
    00127         m_length = length;
    00128 }
    00129 inline
    00130 void gnSourceQualifier::SetValueLoc(const pair<uint32, uint32> startLen){
    00131         m_start = startLen.first;
    00132         m_length = startLen.second;
    00133 }
    00134
    00135 #endif
    00136         // _gnSourceQualifier_h_