Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FragmentLibraryManager.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/fragment/picking_old/FragmentLibraryManager.cc
11 /// @brief singleton class for accessing fragment libraries
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 // unit headers
16 
17 // package headers
20 
21 // project headers
22 #include <basic/database/open.hh>
23 #include <basic/options/option.hh>
24 #include <basic/options/keys/in.OptionKeys.gen.hh>
25 
26 #include <utility/vector1.hh>
27 
28 
29 
30 namespace core {
31 namespace fragment {
32 namespace picking_old {
33 
34 
35 // static initialization
36 FragmentLibraryManager * FragmentLibraryManager::instance_ = NULL;
37 
38 
39 /// @brief default constructor
41  vall_( NULL )
42 {}
43 
44 
45 /// @brief return singleton instance of manager
47  // TODO: we need proper locking support here for multi-threaded access
48  if ( instance_ == NULL ) {
50  }
51 
52  return instance_;
53 }
54 
55 
56 /// @brief return instance of standard Vall library
58  using namespace basic::options::OptionKeys;
59  using basic::options::option;
60  using basic::database::full_name;
61 
62  // TODO: we need proper locking support here for multi-threaded access
63  if ( vall_ == NULL ) {
64  vall_ = new vall::VallLibrary();
65  vall::vall_library_from_file( full_name( option[ in::file::vall ][1] ), *vall_, 62471 );
66  }
67 
68  return *vall_;
69 }
70 
71 
72 /// @brief clear standard Vall library from memory
74  if ( vall_ != NULL ) {
75  delete vall_;
76  vall_ = NULL;
77  }
78 }
79 
80 
81 } // picking_old
82 } // fragment
83 } // core