After tested under windows.
[dyninst.git] / patchAPI / h / SnippetRep.h
1 /* Plugin Interface */
2
3 #ifndef PATCHAPI_H_SNIPPETREP_H_
4 #define PATCHAPI_H_SNIPPETREP_H_
5
6 #include "common.h"
7
8 namespace Dyninst {
9 namespace PatchAPI {
10
11 /* Representation of snippet
12    We don't template PatchAPI::Snippet class, because we don't want
13    to template all other classes that utilizes PatchAPI::Snippet.
14    So, we add another layer of indirection: SnippetRep.
15
16    Usage:
17    SnippetRep<AstNodePtr>* rep = new SnippetRep<AstNodePtr>(ast);
18    SnippetPtr snip = Snippet::create(rep); */
19
20 template <class T>
21 class SnippetRep {
22   public:
23     explicit SnippetRep(T rep) : rep_(rep) {}
24     ~SnippetRep() {}
25
26     T rep() { return rep_; }
27
28   protected:
29     T rep_;
30 };
31
32 }
33 }
34 #endif  // PATCHAPI_H_SNIPPETREP_H_