本文整理汇总了C++中std::tr1::shared_ptr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::get方法的具体用法?C++ shared_ptr::get怎么用?C++ shared_ptr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_item_to_feed
void rss_parser::add_item_to_feed(std::tr1::shared_ptr<rss_feed> feed, std::tr1::shared_ptr<rss_item> item) {
// only add item to feed if it isn't on the ignore list or if there is no ignore list
if (!ign || !ign->matches(item.get())) {
feed->add_item(item);
LOG(LOG_INFO, "rss_parser::parse: added article title = `%s' link = `%s' ign = %p", item->title().c_str(), item->link().c_str(), ign);
} else {
LOG(LOG_INFO, "rss_parser::parse: ignored article title = `%s' link = `%s'", item->title().c_str(), item->link().c_str());
}
}
示例2: pollOSC
void App::pollOSC()
{
if (0 == osc_receiver_.get())
return;
if (osc_receiver_.get()->isRunning())
{
std::vector<tempi::Message> messages = osc_receiver_.get()->poll();
std::vector<tempi::Message>::iterator iter;
for (iter = messages.begin(); iter != messages.end(); ++iter)
{
tempi::Message msg = (*iter);
if (msg.indexMatchesType(0, tempi::STRING))
if (! handleOscMessage(msg))
std::cout << "Unhandled OSC message: " << msg << std::endl;
else if (verbose_)
std::cout << "Handled OSC message: " << msg << std::endl;
}
}
}
示例3: push
inline Value push(std::tr1::shared_ptr<T> newProp)
{
if (dynamic_cast<NumericProperty*>(newProp.get()))
{
_numericProperties.push_back(Value(newProp));
return _numericProperties.back();
}
_namedProperties.push_back(Value(newProp));
return _namedProperties.back();
}
示例4: GetMainThreadId
DWORD GetMainThreadId(void)
{
const std::tr1::shared_ptr<void> hThreadSnapshot(CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0), CloseHandle);
if (hThreadSnapshot.get() == INVALID_HANDLE_VALUE)
{
add_log("GetMainThreadId failed");
return 0;
}
THREADENTRY32 tEntry;
tEntry.dwSize = sizeof(THREADENTRY32);
DWORD result = 0;
DWORD currentPID = GetCurrentProcessId();
for (BOOL success = Thread32First(hThreadSnapshot.get(), &tEntry);
!result && success && GetLastError() != ERROR_NO_MORE_FILES;
success = Thread32Next(hThreadSnapshot.get(), &tEntry))
{
if (tEntry.th32OwnerProcessID == currentPID)
{
result = tEntry.th32ThreadID;
}
}
return result;
}
示例5: startOSC
bool App::startOSC()
{
// starts OSC
if (osc_recv_port_ == 0)
{
std::cout << "OSC receiving disabled." << std::endl;
return false;
}
else
{
osc_receiver_.reset(new tempi::osc::OscReceiver(osc_recv_port_));
std::cout << "Receive OSC from " << (*osc_receiver_.get()) << std::endl;
}
return true;
}
示例6: hasValue
bool hasValue() const
{
std::tr1::try_mutex::scoped_try_lock lock(*mutex);
return lock && result->get();
}
示例7: Sub
struct Sub {Object *_o; Sub(Object *o) :_o(o) {} bool operator ()(const std::tr1::shared_ptr<Object > &a) {return _o == a.get(); } };
示例8: operator
struct Sub {bool operator ()(const std::tr1::shared_ptr<Object > &a) {return dynamic_cast<Target *>(a.get()) != 0; } };