GraphLab: Distributed Graph-Parallel API
2.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
serializable_concept.hpp
1
/**
2
* Copyright (c) 2009 Carnegie Mellon University.
3
* All rights reserved.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing,
12
* software distributed under the License is distributed on an "AS
13
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
* express or implied. See the License for the specific language
15
* governing permissions and limitations under the License.
16
*
17
* For more about this software visit:
18
*
19
* http://www.graphlab.ml.cmu.edu
20
*
21
*/
22
23
24
#ifndef GRAPHLAB_SERIALIZABLE
25
#define GRAPHLAB_SERIALIZABLE
26
#include <boost/concept/assert.hpp>
27
#include <boost/concept/requires.hpp>
28
#include <boost/concept_check.hpp>
29
#include <sstream>
30
#include <graphlab/serialization/serialize.hpp>
31
namespace
graphlab {
32
33
/**
34
* \brief Concept checks if a type T is serializable.
35
*
36
* This is a concept checking class for boost::concept and can be
37
* used to enforce that a type T is \ref sec_serializable, assignable and
38
* default constructible.
39
*
40
* \tparam T The type to test for serializability.
41
*/
42
template
<
typename
T>
43
class
Serializable
: boost::Assignable<T>, boost::DefaultConstructible<T> {
44
public
:
45
BOOST_CONCEPT_USAGE(
Serializable
) {
46
std::stringstream strm;
47
oarchive
oarc(strm);
48
iarchive
iarc(strm);
49
const
T const_t = T();
50
T t = T();
51
// A compiler error on these lines implies that your type is not
52
// serializable. See the documentaiton on how to make
53
// serializable type.
54
oarc << const_t;
55
iarc >> t;
56
}
57
};
58
59
}
// namespace graphlab
60
#endif
61
graphlab
serialization
serializable_concept.hpp
Generated on Mon Jun 3 2013 05:00:04 for GraphLab: Distributed Graph-Parallel API by
1.8.1.1