GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unsupported_serialize.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_UNSUPPORTED_SERIALIZE_HPP
25 #define GRAPHLAB_UNSUPPORTED_SERIALIZE_HPP
26 
27 #include <graphlab/serialization/iarchive.hpp>
28 #include <graphlab/serialization/oarchive.hpp>
30 
31 namespace graphlab {
32 
33  /**
34  * \ingroup group_serialization
35  * \brief Inheritting from this class will prevent the serialization
36  * of the derived class. Used for debugging purposes.
37  *
38  * Inheritting from this class will result in an assertion failure
39  * if any attempt is made to serialize or deserialize the derived
40  * class. This is largely used for debugging purposes to enforce
41  * that certain types are never serialized
42  */
44  void save(oarchive& archive) const {
45  ASSERT_MSG(false, "trying to serialize an unserializable object");
46  }
47  void load(iarchive& archive) {
48  ASSERT_MSG(false, "trying to deserialize an unserializable object");
49  }
50  }; // end of struct
51 };
52 
53 
54 /**
55 \ingroup group_serialization
56 \brief A macro which disables the serialization of type so that
57 it will fault at runtime.
58 
59 Writing GRAPHLAB_UNSERIALIZABLE(T) for some typename T in the global namespace
60 will result in an assertion failure if any attempt is made to serialize or
61 deserialize the type T. This is largely used for debugging purposes to enforce
62 that certain types are never serialized.
63 */
64 #define GRAPHLAB_UNSERIALIZABLE(tname) \
65  BEGIN_OUT_OF_PLACE_LOAD(arc, tname, tval) \
66  ASSERT_MSG(false,"trying to deserialize an unserializable object"); \
67  END_OUT_OF_PLACE_LOAD() \
68  \
69  BEGIN_OUT_OF_PLACE_SAVE(arc, tname, tval) \
70  ASSERT_MSG(false,"trying to serialize an unserializable object"); \
71  END_OUT_OF_PLACE_SAVE() \
72 
73 
74 #endif
75