source: proiecte/HadoopJUnit/hadoop-0.20.1/src/c++/librecordio/recordio.hh @ 141

Last change on this file since 141 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1/**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef RECORDIO_HH_
20#define RECORDIO_HH_
21
22#include <stdio.h>
23#include <stdint.h>
24#include <iostream>
25#include <cstring>
26#include <string>
27#include <vector>
28#include <map>
29#include <bitset>
30
31namespace hadoop {
32 
33class InStream {
34public:
35  virtual ssize_t read(void *buf, size_t buflen) = 0;
36  virtual ~InStream() {}
37};
38
39class OutStream {
40public:
41  virtual ssize_t write(const void *buf, size_t len) = 0;
42  virtual ~OutStream() {}
43};
44
45class IArchive;
46class OArchive;
47
48class Record {
49public:
50  virtual void serialize(OArchive& archive, const char* tag) const = 0;
51  virtual void deserialize(IArchive& archive, const char* tag) = 0;
52  virtual const std::string& type() const = 0;
53  virtual const std::string& signature() const = 0;
54  virtual ~Record() {}
55};
56
57enum RecFormat { kBinary, kXML, kCSV };
58
59class RecordReader {
60private:
61  IArchive* mpArchive;
62public:
63  RecordReader(InStream& stream, RecFormat f);
64  virtual void read(hadoop::Record& record);
65  virtual ~RecordReader();
66};
67
68class RecordWriter {
69private:
70  OArchive* mpArchive;
71public:
72  RecordWriter(OutStream& stream, RecFormat f);
73  virtual void write(const hadoop::Record& record);
74  virtual ~RecordWriter();
75};
76}; // end namspace hadoop
77
78#include "archive.hh"
79#include "exception.hh"
80
81#endif /*RECORDIO_HH_*/
82
Note: See TracBrowser for help on using the repository browser.