Evita  0.16
evCodec.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evCodec_h
25 #define __evCodec_h
26 
27 
28 #include "evProcessObject.h"
29 #include "evField.h"
30 #include "evBitBuffer.h"
31 #include "evProgressReporter.h"
32 
33 
34 class evDataset;
35 
36 
37 class evCodec : public evProcessObject
38 {
39 public:
40  evCodec(void);
41  virtual ~evCodec(void);
42 
43  virtual const evString GetClassName(void) const
44  {
45  return(evString("evCodec"));
46  }
47 
48  virtual int Encode(evBitBuffer &output_buffer,
49  evDataset &dataset,
50  evProgressReporter *progress_reporter = NULL) = 0;
51  virtual int EncodeHeader(evFile &outfile, evDataset &dataset) const = 0;
52 
53  virtual int Decode(evBitBuffer &input_buffer,
54  evDataset &dataset,
55  evProgressReporter *progress_reporter = NULL) = 0;
56  virtual int DecodeHeader(evFile &infile, evDataset &dataset) = 0;
57 
58  static evCodec *Create(const evString &compression_algorithm);
59 
60  unsigned int GetNumComponentsToCode(void) const;
61  void SetComponentsToCode(const unsigned int num_components_to_code,
62  const unsigned int *components_to_code = NULL);
63  unsigned int FindComponent(const unsigned int component) const;
64 
65 protected:
66 
67  std::vector<unsigned int> ComponentsToCode;
68 
69 private:
70 
71 };
72 
73 
74 inline evCodec::evCodec(void)
75 {
76 }
77 
78 
79 inline evCodec::~evCodec(void)
80 {
81 }
82 
83 
84 inline unsigned int evCodec::GetNumComponentsToCode(void) const
85 {
86  return(this->ComponentsToCode.size());
87 }
88 
89 
90 inline unsigned int evCodec::FindComponent(const unsigned int component) const
91 {
92  return(std::find(this->ComponentsToCode.begin(),
93  this->ComponentsToCode.end(),
94  component) - this->ComponentsToCode.begin());
95 }
96 
97 
98 #endif
Definition: evFile.h:44
static evCodec * Create(const evString &compression_algorithm)
virtual const evString GetClassName(void) const
Definition: evCodec.h:43
unsigned int FindComponent(const unsigned int component) const
Definition: evCodec.h:90
Definition: evProgressReporter.h:32
void SetComponentsToCode(const unsigned int num_components_to_code, const unsigned int *components_to_code=NULL)
std::vector< unsigned int > ComponentsToCode
Definition: evCodec.h:67
virtual ~evCodec(void)
Definition: evCodec.h:79
Definition: evDataset.h:34
virtual int DecodeHeader(evFile &infile, evDataset &dataset)=0
virtual int EncodeHeader(evFile &outfile, evDataset &dataset) const =0
Definition: evBitBuffer.h:34
virtual int Encode(evBitBuffer &output_buffer, evDataset &dataset, evProgressReporter *progress_reporter=NULL)=0
unsigned int GetNumComponentsToCode(void) const
Definition: evCodec.h:84
Definition: evCodec.h:37
evCodec(void)
Definition: evCodec.h:74
Definition: evProcessObject.h:31
virtual int Decode(evBitBuffer &input_buffer, evDataset &dataset, evProgressReporter *progress_reporter=NULL)=0
Definition: evString.h:30