本文整理汇总了C++中boost::shared_ptr类的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr类的具体用法?C++ shared_ptr怎么用?C++ shared_ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了shared_ptr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: BOOST_FOREACH
BOOST_FOREACH(boost::shared_ptr<count_writer_t> p_count_writer, mCellPopulationCountWriters)
{
p_count_writer->OpenOutputFile(rOutputFileHandler);
p_count_writer->WriteHeader(this);
}
开发者ID:ktunya,项目名称:Chaste,代码行数:5,代码来源:AbstractCellPopulation.cpp
示例2: assert
void ribi::gtst::ParticipantDialogStateChooseAction::RespondToTimedServerPush()
{
const int time_left = m_server->GetStates()->GetCurrentState()->GetTimeLeft();
//Update label_time_left
{
std::string text
= std::string("Time left: ")
+ std::to_string(time_left)
+ std::string(" seconds");
if (m_server->GetParameters()->GetChooseAction()->GetWait())
{
//Infinite time
text+=std::string(" (waiting for others)");
}
assert(ui.m_label_time_left);
ui.m_label_time_left->setText(text.c_str());
}
//Check if choice must be sent to the server
if (!m_server->GetParameters()->GetChooseAction()->GetWait()
&& time_left <= 0)
{
assert(GetDialog());
assert(GetDialog()->CanGetParticipant());
if (ui.m_button_choose_action->isEnabled())
{
//Let Participant choose a random action by time
const int selected = ui.m_group->selectedButtonIndex();
assert(ui.m_group->count() > 0);
const int action_index
= (selected == -1 //Did user select something?
? std::rand() % ui.m_group->count() //Take a random action
: selected);
assert(action_index > -1 && action_index < ui.m_group->count());
ui.m_group->setSelectedButtonIndex(action_index);
OnChooseActionClick();
}
}
if (!ui.m_button_choose_action->isEnabled())
{
assert(ui.m_group->selectedButtonIndex() != -1
&& "m_button_choose_action should only disable when an action is selected");
const std::vector<boost::shared_ptr<ChooseActionOption> >& options
= m_server->GetParameters()->GetChooseAction()->GetOptions();
assert(ui.m_group->selectedButtonIndex() < static_cast<int>(options.size()));
const boost::shared_ptr<ChooseActionOption> option
= options[ ui.m_group->selectedButtonIndex() ];
const std::string text
= option->GetMessageChoice()
+ std::string("\', waiting for the others...");
ui.m_label_status->setText(text.c_str());
}
else
{
ui.m_label_status->setText("Please choose an action.");
}
///Follow the server its tempo
RespondToParticipant();
}
开发者ID:richelbilderbeek,项目名称:GTST,代码行数:68,代码来源:gtstparticipantdialogstatechooseaction.cpp
示例3: locked_ptr
template<typename F, typename G> locked_ptr(boost::shared_ptr<T> pointer, F lock, G unlock):
boost::shared_ptr<T>(pointer.get(), unlock),
value(pointer)
{
lock();
};
开发者ID:lessc0de,项目名称:Clarus,代码行数:6,代码来源:locker.hpp
示例4: CellsCreatorFactory
void ribi::TriangleMeshCreatorMenuDialog::TestDeep() noexcept
{
const bool verbose{false};
if (verbose) { TRACE("Trying out to build cells from the hardest testing templates"); }
{
using ribi::trim::Cell;
using ribi::trim::CellsCreator;
using ribi::trim::CellsCreatorFactory;
using ribi::trim::CreateVerticalFacesStrategy;
using ribi::trim::CreateVerticalFacesStrategies;
using ribi::trim::Dialog;
using ribi::trim::Template;
//This is the longest test by far
//const TestTimer test_timer(boost::lexical_cast<std::string>(__LINE__),__FILE__,1.0);
for (CreateVerticalFacesStrategy strategy: CreateVerticalFacesStrategies().GetAll())
{
const boost::shared_ptr<Template> my_template {
Template::CreateTest(3)
};
const int n_cell_layers = 2;
const boost::shared_ptr<CellsCreator> cells_creator{
CellsCreatorFactory().Create(
my_template,
n_cell_layers,
1.0 * boost::units::si::meter,
strategy,
verbose
)
};
const std::vector<boost::shared_ptr<Cell>> cells { cells_creator->GetCells() };
assert(cells.size() > 0);
}
}
if (verbose) { TRACE("Testing case 1"); }
TriangleMeshCreatorMenuDialog().Execute(
{
"TriangleMeshCreator",
"--layer_height", "1",
"--WKT", "POLYGON((1 1,-1 1,-1 -1,1 -1))",
"--strategy", "1",
"--n_layers", "1",
"--fraction", "0.75",
//"--show_mesh",
//"--verbose",
"--triangle_max_area", "10.0",
"--triangle_min_angle", "20.0",
"--profile"
}
);
if (verbose) { TRACE("Testing case 2"); }
TriangleMeshCreatorMenuDialog().Execute(
{
"TriangleMeshCreator",
"-z", "1",
"-w", "POLYGON((0 0,0 3,3 0)),POLYGON((1 1,0 2,2 0))",
"-s", "1",
"-n", "1",
"-f", "0.75",
//"-m",
//"-b",
"--triangle_area", "10.0",
"--triangle_quality", "20.0",
"--profile"
}
);
if (verbose) { TRACE("Testing case 3"); }
TriangleMeshCreatorMenuDialog().Execute(
{
"TriangleMeshCreator",
"-z", "1",
"-w", "POLYGON((10 10,10 -10,-10 -10,-10 10)),LINESTRING(5 5,5 -5,-5 -5,-5 5)",
"-s", "1",
"-n", "1",
"-f", "0.75",
//"-m",
//"-b",
"-r", "10.0",
"-q", "20.0",
"--profile"
}
);
if (verbose) { TRACE("Testing case 4"); }
TriangleMeshCreatorMenuDialog().Execute(
{
"TriangleMeshCreator",
"-z", "1",
"-w", "LINESTRING(5 5,5 -5,-5 -5,-5 5)",
"-s", "1",
"-n", "1",
"-f", "0.75",
//"-m",
//"-b",
"-r", "10.0",
"-q", "20.0",
"--profile"
}
);
//.........这里部分代码省略.........
开发者ID:richelbilderbeek,项目名称:TriangleMeshCreator,代码行数:101,代码来源:trianglemeshcreatormenudialog.cpp
示例5: throw
void VectorPort::onChildCreate(
const boost::shared_ptr<BaseVectorType::ChildType>& inCreatedChild) const throw (Error) {
inCreatedChild->setName(getName());
}
开发者ID:torc-isi,项目名称:torc,代码行数:4,代码来源:VectorPort.cpp
示例6:
Connection::Connection(boost::shared_ptr< Hive > hive)
: m_hive(hive), m_socket(hive->GetService()), m_io_strand(hive->GetService()), m_timer(hive->GetService()), m_receive_buffer_size(4096), m_timer_interval(1000), m_error_state(0)
{
}
开发者ID:miguelangelo78,项目名称:BoostAsio-Net-Wrapper,代码行数:4,代码来源:network_sockapi.cpp
示例7: OverlayPluginTestFixture
OverlayPluginTestFixture()
{
arrayPool = new NDArrayPool(100, 0);
expectedArrayCounter=0;
// Asyn manager doesn't like it if we try to reuse the same port name for multiple drivers
// (even if only one is ever instantiated at once), so we change it slightly for each test case.
std::string simport("simOVER1"), testport("OVER1");
uniqueAsynPortName(simport);
uniqueAsynPortName(testport);
// We need some upstream driver for our test plugin so that calls to connectArrayPort
// don't fail, but we can then ignore it and send arrays by calling processCallbacks directly.
driver = boost::shared_ptr<asynPortDriver>(new asynPortDriver(simport.c_str(),
1, 1,
asynGenericPointerMask,
asynGenericPointerMask,
0, 0, 0, 2000000));
// This is the plugin under test
Overlay = boost::shared_ptr<OverlayPluginWrapper>(new OverlayPluginWrapper(testport.c_str(),
50,
1,
simport.c_str(),
0,
8,
0,
0,
0,
1));
// This is the mock downstream plugin
downstream_plugin = new TestingPlugin(testport.c_str(), 0);
// Enable the plugin
Overlay->start(); // start the plugin thread although not required for this unittesting
Overlay->write(NDPluginDriverEnableCallbacksString, 1);
Overlay->write(NDPluginDriverBlockingCallbacksString, 1);
client = boost::shared_ptr<asynGenericPointerClient>(new asynGenericPointerClient(testport.c_str(), 0, NDArrayDataString));
client->registerInterruptUser(&Overlay_callback);
// Test a "normal" case
overlayTempCaseStr test1 = {0, 500, 500, 50, 50, 1, 1, 0, 255, 0, NDOverlayCross, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test1);
// Test a case with size larger than array
overlayTempCaseStr test2 = {0, 500, 500, 5000, 5000, 1, 1, 0, 255, 0, NDOverlayEllipse, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test2);
// Test a case with zero size
overlayTempCaseStr test3 = {0, 500, 500, 0, 0, 1, 1, 0, 255, 0, NDOverlayRectangle, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test3);
// Test a case with negative position
overlayTempCaseStr test4 = {0, -500, -500, 50, 50, 1, 1, 0, 255, 0, NDOverlayCross, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test4);
// Test a case with position larger than array size
overlayTempCaseStr test5 = {0, 1500, 1500, 50, 50, 1, 1, 0, 255, 0, NDOverlayEllipse, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test5);
// Test an RGB1 case
overlayTempCaseStr test6 = {0, 500, 500, 50, 50, 1, 1, 0, 255, 0, NDOverlayRectangle, NDOverlaySet, 3, {3, 1024, 1024}, NDColorModeRGB1};
appendTestCase(&overlayTestCaseStrs, &test6);
// Test an case with very large width
overlayTempCaseStr test7 = {0, 500, 500, 50, 50, 5000, 5000, 0, 255, 0, NDOverlayCross, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test7);
// Test an case with zero width
overlayTempCaseStr test8 = {0, 500, 500, 50, 50, 0, 0, 0, 255, 0, NDOverlayCross, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test8);
// Test a "normal" case using address 1
overlayTempCaseStr test9 = {1, 500, 500, 50, 50, 1, 1, 0, 255, 0, NDOverlayCross, NDOverlaySet, 2, {1024, 1024}, NDColorModeMono};
appendTestCase(&overlayTestCaseStrs, &test9);
}
开发者ID:prjemian,项目名称:ADCore,代码行数:69,代码来源:test_NDPluginOverlay.cpp
示例8: Add
void Add( const boost::shared_ptr<T>& prt )
{
if ( prt_.empty() )
prt->SetFocus();
prt_.push_back(prt);
}
开发者ID:masaedw,项目名称:zugagaga,代码行数:6,代码来源:ztk.hpp
示例9: print_fun
void print_fun(boost::shared_ptr<int> value)
{cout<<"fun : value is = "<<*value<<", use_count = "<<value.use_count()<<endl;}
开发者ID:ChinaChenp,项目名称:devserver,代码行数:2,代码来源:smart_ptr.cpp
示例10: writePartial
void OgrWriter::writePartial(const boost::shared_ptr<const hoot::Relation>& newRelation)
{
// Make sure all the elements in the relation are in the cache
const std::vector<RelationData::Entry>& relationEntries = newRelation->getMembers();
std::vector<RelationData::Entry>::const_iterator relationElementIter;
long nodeCount = 0;
long wayCount = 0;
long relationCount = 0;
for ( relationElementIter = relationEntries.begin();
relationElementIter != relationEntries.end();
relationElementIter++ )
{
switch ( relationElementIter->getElementId().getType().getEnum() )
{
case ElementType::Node:
nodeCount++;
if ( nodeCount > _currElementCacheCapacity )
{
LOG_FATAL("Relation ID " << newRelation->getId() <<
" contains more nodes than can fit in the cache (" << _currElementCacheCapacity<<
")");
throw HootException("Relation with too many nodes");
}
break;
case ElementType::Way:
wayCount++;
if ( wayCount > _currElementCacheCapacity)
{
LOG_FATAL("Relation ID " << newRelation->getId() <<
" contains more ways than can fit in the cache (" << _currElementCacheCapacity <<
")");
throw HootException("Relation with too many ways");
}
break;
case ElementType::Relation:
relationCount++;
if ( relationCount > _currElementCacheCapacity)
{
LOG_FATAL("Relation ID " << newRelation->getId() <<
" contains more relations than can fit in the cache (" << _currElementCacheCapacity <<
")");
throw HootException("Relation with too many relations");
}
break;
default:
throw HootException("Relation containus unknown type");
break;
}
if ( _elementCache->containsElement(relationElementIter->getElementId()) == false )
{
throw HootException("Relation element did not exist in cache");
}
}
// Add to the cache
ConstElementPtr constRelation(newRelation);
_elementCache->addElement(constRelation);
ElementProviderPtr cacheProvider(_elementCache);
_writePartial(cacheProvider, newRelation);
}
开发者ID:giserh,项目名称:hootenanny,代码行数:66,代码来源:OgrWriter.cpp
示例11:
cql::cql_message_query_impl_t::cql_message_query_impl_t(const boost::shared_ptr<cql_query_t>& query)
: _buffer(new std::vector<cql_byte_t>())
, _consistency(query->consistency())
, _query(query->query())
, _is_traced(query->is_traced())
{}
开发者ID:jacekkasprzak,项目名称:cpp-driver,代码行数:6,代码来源:cql_message_query_impl.cpp
示例12: peek
void PeekProcessor::peek(boost::shared_ptr<TProtocol> in,
TType ftype,
int16_t fid) {
(void) fid;
in->skip(ftype);
}
开发者ID:1ack,项目名称:Impala,代码行数:6,代码来源:PeekProcessor.cpp
示例13: DispatchAccept
void Acceptor::DispatchAccept(boost::shared_ptr< Connection > connection)
{
m_acceptor.async_accept(connection->GetSocket(), connection->GetStrand().wrap(boost::bind(&Acceptor::HandleAccept, shared_from_this(), _1, connection)));
}
开发者ID:miguelangelo78,项目名称:BoostAsio-Net-Wrapper,代码行数:4,代码来源:network_sockapi.cpp
示例14: compare_scans
void compare_scans(boost::shared_ptr<vector<line> > firstScan,
boost::shared_ptr<vector<line> > secondScan,
int rotation_prior_mean,
int& rotOut,
Vector2f translation_prior_mean,
Vector2f & translationOut)
{
int num_theta_entries = (2 * M_PI -
delta_theta*angle_increment)/(delta_theta*M_PI/180) + 1;
vector<float> theta = vector<float>(num_theta_entries);
for(double i = -M_PI, counter = 0; counter < num_theta_entries;
i+= delta_theta*M_PI/180, counter++) {
theta[counter] = i;
}
//Initial rotation estimation. This will vary depending on the
//lines being compared.
// Vector2f translation_prior_mean = previous_translation;
float translation_prior_sd = 0.5;
// float rotation_prior_mean = previous_est_rot;
float rotation_prior_sd = 15;
float rotation_posterior_sd = 4;
vector<float> rotation_prior (360,0);
vector<float> rotation_score (360,0);
float dist;
float sum1;
for (int i=0; i<360; i++)
{
dist = min(abs(i - rotation_prior_mean),abs(i-360-rotation_prior_mean));
rotation_prior[i] = exp(-pow(dist,2)/pow(rotation_prior_sd,2));
sum1 += rotation_prior[i];
}
for (int i=0; i<360; i++)
{
rotation_prior[i] /= sum1;
}
//for each pair of lines between the two scans, estimate the
// probability that they are from the same object. The more likely they
// are to be by an unmoved object, the more likely that the rotation of
// the was equal to the theta difference between the lines.
for (int i=0; i < firstScan->size(); i++)
{
for (int j=0; j < secondScan->size(); j++)
{
float dist;
float theta_diff = (delta_theta*(firstScan->at(i).theta_index -
secondScan->at(j).theta_index) );
if (theta_diff < 0) {
theta_diff += 360;
}
//if the lines are clearly not from the same source because the
// translation has moved too much for one frame, then do not use their
// relative angles to estimate the rotation.
float expected_rho_change;
expected_rho_change =
-(translation_prior_mean[0]*cos(theta[firstScan->at(i).theta_index]) +
translation_prior_mean(1)*sin(theta[firstScan->at(i).theta_index]) );
if(abs(firstScan->at(i).est_rho + expected_rho_change -
secondScan->at(j).est_rho) > rho_sanity_tolerance)
{
continue;
}
for (int k=0; k<360; k++)
{
dist = min(abs(k-theta_diff), abs(k-theta_diff-360));
rotation_score[k] = rotation_score[k] +
exp(-pow(dist,2)/pow(rotation_posterior_sd,2));
}
}
}
vector<float> rotation_prob(360,0);
for (int i=0; i<rotation_prob.size(); i++) {
rotation_prob[i] = rotation_prior[i]* rotation_score[i];
//rotation_prob[i] = rotation_score[i];
}
float max1 = 0;
for (int i=0; i<rotation_prob.size(); i++) {
if (rotation_prob[i]> max1) {
//.........这里部分代码省略.........
开发者ID:Russell91,项目名称:USCAerialRobotics,代码行数:101,代码来源:odometry.cpp
示例15: signalSessionAdded
void
SessionManager::addDataprocessor( boost::shared_ptr<Dataprocessor>& proc )
{
sessions_.push_back( Session( proc ) );
emit signalSessionAdded( proc.get() );
}
开发者ID:HiroyukiSeki,项目名称:qtplatz,代码行数:6,代码来源:sessionmanager.cpp
示例16: lines_callback
void lines_callback(const art_lrf::Lines::ConstPtr& msg_lines) {
if ((msg_lines->theta_index.size() != 0) &&
(msg_lines->est_rho.size() != 0) && (msg_lines->endpoints.size() !=
0)) {
scan2.reset(new vector<line> ());
line temp;
geometry_msgs::Point32 temp2;
geometry_msgs::Point32 temp_theta_index;
vector<int> temp3;
for (int i = 0; i < msg_lines->theta_index.size(); i++) {
temp.theta_index = msg_lines->theta_index[i];
temp.est_rho = msg_lines->est_rho[i];
for (int j = 0; j < msg_lines->endpoints[i].points.size(); j++) {
temp2 = msg_lines->endpoints[i].points[j];
temp3.push_back(temp2.x);
temp3.push_back(temp2.y);
temp.endpoints.push_back(temp3);
}
scan2->push_back(temp);
temp.endpoints.clear();
}
if (firstRun == true) {
firstRun = false;
scan1 = scan2;
previous_translation << 0,0;
}
else
{
compare_scans(scan1, scan2, previous_est_rot, est_rot,
previous_translation, est_translation );
if( pow(pow(est_translation[0],2) + pow(est_translation[1],2),0.5) >
WAYPOINT_THRESHOLD)
{
measurement new_base;
for(int i=0; i<scan1->size(); i++)
{
new_base.lines.push_back(scan1->at(i));
}
new_base.x = base_translation(0) + est_translation(0);
new_base.y = base_translation(1) + est_translation(1);
new_base.yaw = base_rot;
// float min_dist = 2*REMATCH_CANDIDATE_THRESH; //start with
// arbitrarily high value
// int min_index = 0;
// for( int i=0; i<base_scans.size(); i++)
// {
// float current_dist = base_scans[i].dist_from(new_base);
// if( current_dist < min_dist )
// {
// min_index = i;
// min_dist = current_dist;
// }
// }
// if(min_dist < REMATCH_CANDIDATE_THRESH)
// {
// boost::shared_ptr<vector<line> > temp_boost_scan(new vector<line>);
// for(int i=0; i<base_scans[min_index].lines.size(); i++)
// {
// temp_boost_scan->push_back(base_scans[min_index].lines[i]);
// }
// int expected_rot_difference = new_base.yaw -
//base_scans[min_index].yaw;
// int actual_rot_difference;
// Vector2f expected_translation_difference;
// expected_translation_difference << new_base.x -
//base_scans[min_index].x, new_base.y - base_scans[min_index].y;
// Vector2f actual_translation_difference;
// compare_scans(temp_boost_scan, scan2,
// new_base.yaw - base_scans[min_index].yaw,
//actual_rot_difference,
// expected_translation_difference,
//actual_translation_difference );
// float translation_error =
// pow(pow(expected_translation_difference(0) -
// actual_translation_difference(0), 2) +
// pow(expected_translation_difference(1) -
// actual_translation_difference(1),2), 0.5);
// if( (translation_error < REMATCH_VALIDATION_THRESH) &&
//(abs(expected_rot_difference - actual_rot_difference) < 7))
// {
// //overwrite the new_base values with the difference
//between the waypoint and the current scan
// new_base.x = base_scans[min_index].x +
//actual_translation_difference[0];
// new_base.y = base_scans[min_index].y +
//actual_translation_difference[1];
//; // new_base.yaw = base_scans[min_index].yaw + actual_rot_difference;
//.........这里部分代码省略.........
开发者ID:Russell91,项目名称:USCAerialRobotics,代码行数:101,代码来源:odometry.cpp
示例17:
// this makes sure we can store our connections in a set
inline bool operator<(boost::shared_ptr<receiver> const& lhs,
boost::shared_ptr<receiver> const& rhs)
{
return lhs.get() < rhs.get();
}
开发者ID:devangb,项目名称:hpx,代码行数:6,代码来源:receiver.hpp
示例18: TBOX_ASSERT
boost::shared_ptr<HierarchyDataOpsReal<double> >
HierarchyDataOpsManager::getOperationsDouble(
const boost::shared_ptr<hier::Variable>& variable,
const boost::shared_ptr<hier::PatchHierarchy>& hierarchy,
bool get_unique)
{
TBOX_ASSERT(variable);
TBOX_ASSERT(hierarchy);
TBOX_ASSERT_OBJDIM_EQUALITY2(*variable, *hierarchy);
const boost::shared_ptr<pdat::CellVariable<double> > cellvar(
boost::dynamic_pointer_cast<pdat::CellVariable<double>,
hier::Variable>(variable));
const boost::shared_ptr<pdat::FaceVariable<double> > facevar(
boost::dynamic_pointer_cast<pdat::FaceVariable<double>,
hier::Variable>(variable));
const boost::shared_ptr<pdat::NodeVariable<double> > nodevar(
boost::dynamic_pointer_cast<pdat::NodeVariable<double>,
hier::Variable>(variable));
const boost::shared_ptr<pdat::SideVariable<double> > sidevar(
boost::dynamic_pointer_cast<pdat::SideVariable<double>,
hier::Variable>(variable));
const boost::shared_ptr<pdat::EdgeVariable<double> > edgevar(
boost::dynamic_pointer_cast<pdat::EdgeVariable<double>,
hier::Variable>(variable));
boost::shared_ptr<HierarchyDataOpsReal<double> > ops;
if (cellvar) {
if (get_unique) {
ops.reset(new HierarchyCellDataOpsReal<double>(hierarchy));
} else {
const int n = static_cast<int>(d_cell_ops_double.size());
for (int i = 0; i < n && !ops; ++i) {
if (hierarchy !=
d_cell_ops_double[i]->getPatchHierarchy()) continue;
// A compatible operator has been found at i.
ops = d_cell_ops_double[i];
}
if (!ops) {
// No compatible operator has been found.
ops.reset(new HierarchyCellDataOpsReal<double>(hierarchy));
d_cell_ops_double.resize(n + 1);
d_cell_ops_double[n] = ops;
}
}
} else if (facevar) {
if (get_unique) {
ops.reset(new HierarchyFaceDataOpsReal<double>(hierarchy));
} else {
const int n = static_cast<int>(d_face_ops_double.size());
for (int i = 0; i < n && !ops; ++i) {
if (hierarchy !=
d_face_ops_double[i]->getPatchHierarchy()) continue;
// A compatible operator has been found at i.
ops = d_face_ops_double[i];
}
if (!ops) {
// No compatible operator has been found.
ops.reset(new HierarchyFaceDataOpsReal<double>(hierarchy));
d_face_ops_double.resize(n + 1);
d_face_ops_double[n] = ops;
}
}
} else if (nodevar) {
if (get_unique) {
ops.reset(new HierarchyNodeDataOpsReal<double>(hierarchy));
} else {
const int n = static_cast<int>(d_node_ops_double.size());
for (int i = 0; i < n && !ops; ++i) {
if (hierarchy !=
d_node_ops_double[i]->getPatchHierarchy()) continue;
// A compatible operator has been found at i.
ops = d_node_ops_double[i];
}
if (!ops) {
// No compatible operator has been found.
ops.reset(new HierarchyNodeDataOpsReal<double>(hierarchy));
d_node_ops_double.resize(n + 1);
d_node_ops_double[n] = ops;
}
}
} else if (sidevar) {
if (get_unique) {
ops.reset(new HierarchySideDataOpsReal<double>(hierarchy));
} else {
const int n = static_cast<int>(d_side_ops_double.size());
for (int i = 0; i < n && !ops; ++i) {
if (hierarchy !=
d_side_ops_double[i]->getPatchHierarchy()) continue;
// A compatible operator has been found at i.
ops = d_side_ops_double[i];
}
//.........这里部分代码省略.........
开发者ID:00liujj,项目名称:SAMRAI,代码行数:101,代码来源:HierarchyDataOpsManager.C
示例19: handleYOGClientEvent
void YOGLoginScreen::handleYOGClientEvent(boost::shared_ptr<YOGClientEvent> event)
{
//std::cout<<"YOGLoginScreen: recieved event "<<event->format()<<std::endl;
Uint8 type = event->getEventType();
if(type == YEConnected)
{
attemptLogin();
}
else if(type == YEConnectionLost)
{
//shared_ptr<YOGConnectionLostEvent> info = static_pointer_cast<YOGConnectionLostEvent>(event);
animation->visible=false;
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_LOST]"));
}
else if(type == YELoginAccepted)
{
//shared_ptr<YOGLoginAcceptedEvent> info = static_pointer_cast<YOGLoginAcceptedEvent>(event);
animation->visible=false;
runLobby();
}
else if(type == YELoginRefused)
{
shared_ptr<YOGLoginRefusedEvent> info = static_pointer_cast<YOGLoginRefusedEvent>(event);
animation->visible=false;
YOGLoginState reason = info->getReason();
if(reason == YOGPasswordIncorrect)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_BAD_PASSWORD]"));
}
else if(reason == YOGUsernameAlreadyUsed)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_ALREADY_PASSWORD]"));
}
else if(reason == YOGUserNotRegistered)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_BAD_PASSWORD_NON_ZERO]"));
}
else if(reason == YOGClientVersionTooOld)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_PROTOCOL_TOO_OLD]"));
}
else if(reason == YOGAlreadyAuthenticated)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_ALLREADY_USED]"));
}
else if(reason == YOGUsernameBanned)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_BANNED]"));
}
else if(reason == YOGIPAddressBanned)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_IP_TEMPORARILY_BANNED]"));
}
else if(reason == YOGNameInvalidSpecialCharacters)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_USERNAME_INVALID_SPECIAL_CHARACTERS]"));
}
else if(reason == YOGLoginUnknown)
{
statusText->setText(Toolkit::getStringTable()->getString("[YESTS_CONNECTION_REFUSED_UNEXPLAINED]"));
}
client->disconnect();
}
}
开发者ID:krichter722,项目名称:glob2-git-hg,代码行数:64,代码来源:YOGLoginScreen.cpp
示例20: robox_parameters_load
void robox_parameters_load(robox_parameters & params,
boost::shared_ptr<sfl::OptionDictionary> opt)
{
expo_parameters_load(params, opt);
string_to(opt->GetOption("front_nscans"), params.front_nscans);
string_to(opt->GetOption("front_mount_x"), params.front_mount_x);
string_to(opt->GetOption("front_mount_y"), params.front_mount_y);
string_to(opt->GetOption("front_mount_theta"), params.front_mount_theta);
string_to(opt->GetOption("front_rhomax"), params.front_rhomax);
string_to(opt->GetOption("front_phi0"), params.front_phi0);
string_to(opt->GetOption("front_phirange"), params.front_phirange);
string_to(opt->GetOption("rear_nscans"), params.rear_nscans);
string_to(opt->GetOption("rear_mount_x"), params.rear_mount_x);
string_to(opt->GetOption("rear_mount_y"), params.rear_mount_y);
string_to(opt->GetOption("rear_mount_theta"), params.rear_mount_theta);
string_to(opt->GetOption("rear_rhomax"), params.rear_rhomax);
string_to(opt->GetOption("rear_phi0"), params.rear_phi0);
string_to(opt->GetOption("rear_phirange"), params.rear_phirange);
}
开发者ID:,项目名称:,代码行数:21,代码来源:
注:本文中的boost::shared_ptr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论