/usr/include/InsightToolkit/Utilities/MetaIO/metaOutput.h is in libinsighttoolkit3-dev 3.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | /*============================================================================
MetaIO
Copyright 2000-2010 Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "metaTypes.h"
#ifndef __MetaOutput_H_
#define __MetaOutput_H_
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#pragma warning ( disable: 4251 )
#pragma warning ( disable: 4511 ) // copy constructor not found
#pragma warning ( disable: 4512 ) // assignment operator not found
#endif
#include "metaCommand.h"
#include <stdio.h>
#include <string>
#if (METAIO_USE_NAMESPACE)
namespace METAIO_NAMESPACE {
#endif
class MetaOutputStream
{
public:
MetaOutputStream();
virtual ~MetaOutputStream() {};
void SetName(const char* name);
METAIO_STL::string GetName() const;
void Enable();
bool IsEnable() const;
void Disable();
void SetStdStream(METAIO_STREAM::ostream * stream);
bool IsStdStream();
METAIO_STREAM::ostream * GetStdStream();
virtual bool Open();
virtual bool Close();
virtual bool Write(const char* buffer);
void SetMetaOutput(void* metaOutput);
protected:
METAIO_STREAM::ostream * m_StdStream;
bool m_IsStdStream;
bool m_Enable;
bool m_IsOpen;
METAIO_STL::string m_Name;
void* m_MetaOutput;
};
class MetaFileOutputStream : public MetaOutputStream
{
public:
MetaFileOutputStream(const char* name);
virtual ~MetaFileOutputStream() {};
bool Open();
bool Close();
METAIO_STL::string GetFileName();
private:
METAIO_STL::string m_FileName;
METAIO_STREAM::ofstream m_FileStream;
};
class METAIO_EXPORT MetaOutput
{
public:
typedef enum {INT,FLOAT,CHAR,STRING,LIST,FLAG,BOOL} TypeEnumType;
struct Field{
METAIO_STL::string name;
METAIO_STL::string description;
METAIO_STL::vector<METAIO_STL::string> value;
TypeEnumType type;
METAIO_STL::string rangeMin;
METAIO_STL::string rangeMax;
};
typedef METAIO_STL::vector<Field> FieldVector;
typedef METAIO_STL::vector<MetaOutputStream*> StreamVector;
typedef METAIO_STL::list< METAIO_STL::string > ListType;
MetaOutput();
~MetaOutput();
/** Add a field */
bool AddField(METAIO_STL::string name,
METAIO_STL::string description,
TypeEnumType type,
METAIO_STL::string value,
METAIO_STL::string rangeMin = "",
METAIO_STL::string rangeMax = ""
);
bool AddFloatField(METAIO_STL::string name,
METAIO_STL::string description,
float value,
METAIO_STL::string rangeMin = "",
METAIO_STL::string rangeMax = ""
);
bool AddIntField(METAIO_STL::string name,
METAIO_STL::string description,
int value,
METAIO_STL::string rangeMin = "",
METAIO_STL::string rangeMax = ""
);
bool AddListField(METAIO_STL::string name,
METAIO_STL::string description,
ListType list);
/** Set the metaCommand for parsing */
void SetMetaCommand(MetaCommand* metaCommand);
/** Write the output to the connected streams */
void Write();
/** Add a standard stream */
void AddStream(const char* name,METAIO_STREAM::ostream & stream);
void AddStream(const char* name,MetaOutputStream * stream);
/** Add a stream file. Helper function */
void AddStreamFile(const char* name, const char* filename);
/** Enable or Disable a stream */
void EnableStream(const char* name);
void DisableStream(const char* name);
METAIO_STL::string GetHostname(void);
METAIO_STL::string GetHostip(void);
private:
METAIO_STL::string TypeToString(TypeEnumType type);
/** Private function to fill in the buffer */
METAIO_STL::string GenerateXML(const char* filename=NULL);
METAIO_STL::string GetUsername(void);
FieldVector m_FieldVector;
MetaCommand* m_MetaCommand;
StreamVector m_StreamVector;
METAIO_STL::string m_CurrentVersion;
}; // end of class
#if (METAIO_USE_NAMESPACE)
};
#endif
#endif
|