CiftiLib
A C++ library for CIFTI-2 and CIFTI-1 files
CiftiMappingType.h
1 #ifndef __CIFTI_MAPPING_TYPE_H__
2 #define __CIFTI_MAPPING_TYPE_H__
3 
4 /*LICENSE_START*/
5 /*
6  * Copyright (c) 2014, Washington University School of Medicine
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without modification,
10  * are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #include "stdint.h"
32 
33 #include "Common/XmlAdapter.h"
34 
35 namespace cifti
36 {
37 
39  {
40  public:
41  enum MappingType
42  {
43  BRAIN_MODELS,
44  PARCELS,
45  SERIES,
46  SCALARS,
47  LABELS
48  };
49  virtual CiftiMappingType* clone() const = 0;//make a copy, preserving the actual type - NOTE: this returns a dynamic allocation that is not owned by anything
50  virtual MappingType getType() const = 0;
51  virtual int64_t getLength() const = 0;
52  virtual bool operator==(const CiftiMappingType& rhs) const = 0;//used to check for merging mappings when writing the XML - must compare EVERYTHING that goes into the XML
53  bool operator!=(const CiftiMappingType& rhs) const { return !((*this) == rhs); }
54  virtual bool approximateMatch(const CiftiMappingType& rhs, AString* explanation = NULL) const = 0;//check if things like doing index-wise math would make sense
55  virtual void readXML1(XmlReader& xml) = 0;//mainly to shorten the type-specific code in CiftiXML
56  virtual void readXML2(XmlReader& xml) = 0;
57  virtual void writeXML1(XmlWriter& xml) const = 0;
58  virtual void writeXML2(XmlWriter& xml) const = 0;
59  virtual ~CiftiMappingType();
60 
61  static AString mappingTypeToName(const MappingType& type);
62  };
63 }
64 
65 #endif //__CIFTI_MAPPING_TYPE_H__
cifti
namespace for all CiftiLib functionality
Definition: CiftiBrainModelsMap.h:41
cifti::CiftiMappingType
Definition: CiftiMappingType.h:38