Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
protocols
viewer
SilentObserver.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
11
/// @brief
12
/// @author
13
14
// Unit headers
15
#include <
protocols/viewer/SilentObserver.hh
>
16
17
// Package headers
18
// AUTO-REMOVED #include <protocols/viewer/viewers.hh>
19
20
#include <
core/types.hh
>
21
22
#include <
core/io/silent/SilentFileData.hh
>
23
//#include <core/io/silent/ProteinSilentStruct.hh>
24
#include <
core/io/silent/SilentStruct.fwd.hh
>
25
#include <
core/io/silent/SilentStructFactory.hh
>
26
27
#include <
core/pose/Pose.hh
>
28
// AUTO-REMOVED #include <core/pose/signals/DestructionEvent.hh>
29
#include <
core/pose/signals/EnergyEvent.hh
>
30
31
#include <ObjexxFCL/string.functions.hh>
32
33
#include <
core/id/types.hh
>
34
#include <utility/vector1.hh>
35
36
using
ObjexxFCL::string_of;
37
38
39
// Project headers
40
41
// C++ Headers
42
43
44
namespace
protocols {
45
namespace
viewer {
46
47
48
/// @brief default constructor
49
SilentObserver::SilentObserver
() {}
50
51
/// @brief constructor
52
SilentObserver::SilentObserver
(
std::string
const
& name_in,
bool
fullatom =
false
) :
53
frame_count_( 0 ),
54
fullatom_( fullatom ),
55
silent_file_name_( name_in +
".out"
)
56
{
57
sfd_
=
new
core::io::silent::SilentFileData
();
58
}
59
60
61
/// @brief default destructor
62
SilentObserver::~SilentObserver
() {
63
detach_from
();
64
}
65
66
67
/// @brief attach to a Pose
68
void
69
SilentObserver::attach_to
(
Pose
& pose ) {
70
detach_from
();
71
energy_event_link_
= pose.
attach_energy_obs
( &
SilentObserver::on_energy_change
,
this
);
72
}
73
74
75
/// @grief detach from Pose
76
void
77
SilentObserver::detach_from
() {
78
energy_event_link_
.invalidate();
79
}
80
81
82
/// @brief upon receiving an EnergyEvent write to silent file
83
void
84
SilentObserver::on_energy_change
(
85
core::pose::signals::EnergyEvent
const
& event
86
) {
87
frame_count_
++;
88
// std::cout << "frame(" << frame_count_ << ")" << std::endl;
89
//core::io::silent::ProteinSilentStruct pss( *event.pose, "frame" + string_of(frame_count_) );
90
using namespace
core::io::silent;
91
SilentStructOP
ss =
SilentStructFactory::get_instance
()->
get_silent_struct_out
();
92
ss->fill_struct( *event.
pose
,
"frame"
+ string_of(
frame_count_
) );
93
94
sfd_
->write_silent_struct( *ss,
silent_file_name_
);
95
}
96
97
98
}
// namespace conformation
99
}
// namespace core
100
101
Generated on Sat Jun 1 2013 12:25:09 for Rosetta 3.5 by
1.8.4