Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PipeMap.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/io/serialization/PipeMap.cc
11 /// @brief Quick typedef of a map of strings to PipeSP
12 /// @author Ken Jung
13 
15 #include <core/pose/Pose.hh>
16 
17 namespace core {
18 namespace io {
19 namespace serialization {
20 #ifdef USELUA
21 void lregister_PipeMap( lua_State * lstate ) {
22  luabind::module(lstate, "core")
23  [
24  luabind::namespace_("io")
25  [
26  luabind::namespace_("serialization")
27  [
28  luabind::class_<PipeMap, PipeMapSP>("PipeMap")
29  .def(luabind::constructor<>())
30  .def("at", (PipeSP (*) ( PipeMapSP, std::string const & )) &at)
31  .def("insert", &insert)
32  .def("clone", (PipeMapSP (*) ( PipeMapSP)) &clone),
33  luabind::def("inputPipeMap", &inputPipeMap )
34  ]
35  ]
36  ];
37 }
38 
39 void insert( PipeMapSP p, std::string const & pipename, core::pose::PoseSP pose ) {
40  if (p->find( pipename ) == p->end() )
41  (*p)[ pipename ] = PipeSP( new Pipe );
42  (*p)[pipename]->push_back( pose );
43 }
44 
45 PipeSP at( PipeMapSP p, std::string const & pipename ) {
46  return (*p)[pipename];
47 }
48 // this is a deep copy, every PoseSP is dereferenced and copied
50  PipeMapSP newpipemap = PipeMapSP( new PipeMap);
51  for( PipeMap::iterator itr = p->begin(); itr != p->end(); itr ++ ) {
52  (*newpipemap)[itr->first] = PipeSP( new Pipe );
53  for( Pipe::iterator jtr = (*itr->second).begin(); jtr != (*itr->second).end(); jtr++ ){
54  (*(*newpipemap)[itr->first]).push_back( core::pose::PoseSP( new core::pose::Pose( **jtr ) ) );
55  }
56  }
57  return newpipemap;
58 }
59 
61  PipeMapSP pmap = PipeMapSP( new PipeMap);
62  (*pmap)["input"] = PipeSP( new Pipe );
63  (*pmap)["input"]->push_back(p);
64  return pmap;
65 }
66 #endif
67 } //serialization
68 } //io
69 } //core
70