本文整理汇总了C++中FilterPtr类的典型用法代码示例。如果您正苦于以下问题:C++ FilterPtr类的具体用法?C++ FilterPtr怎么用?C++ FilterPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FilterPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: console_filter_selection
int console_filter_selection(ContextPtr env, char *cmd) {
if(!cmd) return 0;
LinkList<Filter> &list = env->getFilters();
LinkList<Filter>::iterator it = std::find_if(list.begin(), list.end(), [&](FilterPtr filter) {
return filter->getName() == cmd;
});
if(it == list.end()) {
::error("filter not found: %s", cmd);
return 0;
}
FilterPtr filt = *it;
ViewPortPtr screen = getSelectedScreen();
if(!screen) {
::error("no screen currently selected");
return 0;
}
LayerPtr lay = getSelectedLayer();
if(!lay) {
::error("no layer selected for effect %s", filt->getName().c_str());
return 0;
}
if(!filt->new_instance()->apply(lay)) {
::error("error applying filter %s on layer %s", filt->getName().c_str(), lay->getName().c_str());
return 0;
}
// select automatically the new filter
// lay->filters.sel(0);
// ff->sel(true);
return 1;
}
示例2: logger
FilterPtr FilterFactory::createFilter(const String &name, DepthCamera::FrameType type)
{
auto x = _supportedFilters.find(name);
if(x == _supportedFilters.end())
{
logger(LOG_ERROR) << "FilterFactory: Could not find filter '" << name << "'" << std::endl;
return nullptr;
}
if(!x->second.supports(type))
{
logger(LOG_ERROR) << "FilterFactory: Filter '" << name << "' does not support frame type '" << type << "'" << std::endl;
return nullptr;
}
if(!x->second._createFilter)
{
logger(LOG_ERROR) << "FilterFactory: Don't know how to create filter '" << name << "'. Report to vendor of FilterFactory '" << _name << "'" << std::endl;
return nullptr;
}
FilterPtr p = x->second._createFilter();
if(p) p->setNameScope(_name);
return p;
}
示例3: append
void FilterGroup::append(FilterPtr filter)
{
mFilters.push_back(filter);
QString uid = QString("%1_%2").arg(filter->getType()).arg(mFilters.size());
XmlOptionFile node = mOptions.descend(uid);
filter->initialize(node.getElement(), uid);
}
示例4: test16
// Test that sequence limiting works
void test16(const DestinationPtr &sink1) {
banner("test16 - sequence limiting");
FilterPtr limited = SequenceFilter::instance(10, 2, 5); // every other message beginning with #10, five total
limited->addDestination(sink1);
Stream merr = Stream("test16", INFO, limited);
for (size_t i=0; i<100; ++i) {
merr <<"i=" <<i <<"\n";
}
}
示例5: Matches
FilterPtr FilterEngine::GetWhitelistingFilter(const std::string& url,
ContentType contentType, const std::string& documentUrl) const
{
FilterPtr match = Matches(url, contentType, documentUrl);
if (match && match->GetType() == Filter::TYPE_EXCEPTION)
{
return match;
}
return FilterPtr();
}
示例6: test15
// Test that rate limiting works
void test15(const DestinationPtr &sink1) {
banner("test15 - rate limiting");
FilterPtr limited = TimeFilter::instance(0.5);
limited->addDestination(sink1);
Stream merr = Stream("test15", INFO, limited);
for (size_t i=0; i<5000000; ++i) {
merr <<"i=" <<i <<"\n";
}
}
示例7: TcpClientTransport
HttpsClientTransport::HttpsClientTransport(const HttpsEndpoint & httpsEndpoint) :
TcpClientTransport(httpsEndpoint.getIp(), httpsEndpoint.getPort())
{
std::vector<FilterPtr> wireFilters;
// HTTP framing.
wireFilters.push_back( FilterPtr( new HttpFrameFilter(
getRemoteAddr().getIp(),
getRemoteAddr().getPort())));
// SSL.
ClientStub * pClientStub = getTlsClientStubPtr();
RCF_ASSERT(pClientStub);
FilterPtr sslFilterPtr;
#if RCF_FEATURE_SSPI==1 && RCF_FEATURE_OPENSSL==1
if (pClientStub->getSslImplementation() == Si_Schannel)
{
sslFilterPtr.reset( new SchannelFilter(pClientStub) );
}
else
{
RCF_ASSERT(pClientStub->getSslImplementation() == Si_OpenSsl);
sslFilterPtr.reset( new OpenSslEncryptionFilter(pClientStub) );
}
#elif RCF_FEATURE_SSPI==1
sslFilterPtr.reset( new SchannelFilter(pClientStub) );
#elif RCF_FEATURE_OPENSSL==1
sslFilterPtr.reset( new OpenSslEncryptionFilter(pClientStub) );
#endif
if (!sslFilterPtr)
{
RCF_THROW( Exception(_RcfError_SslNotSupported()) );
}
wireFilters.push_back(sslFilterPtr);
// HTTP CONNECT filter for passing through a proxy.
wireFilters.push_back( FilterPtr( new HttpConnectFilter(
getRemoteAddr().getIp(),
getRemoteAddr().getPort())));
setWireFilters(wireFilters);
}
示例8: setOption
/** Set all options with the named valueName to the value,
* given that they are of the correct type.
*
* Supported types: bool, double, QString, QColor
*/
void Pipeline::setOption(QString valueName, QVariant value)
{
for (unsigned i=0; i<mFilters->size(); ++i)
{
FilterPtr filter = mFilters->get(i);
std::vector<PropertyPtr> options = filter->getOptions();
for (unsigned j=0; j<options.size(); ++j)
{
if (options[j]->getDisplayName()==valueName)
this->setOption(options[j], value);
}
}
}
示例9: console_filter_completion
int console_filter_completion(ContextPtr env, char *cmd) {
if(!cmd) return 0;
// Find completions
FilterPtr exactFilter;
LinkList<Filter> retList;
LinkList<Filter> &list = env->getFilters();
std::string cmdString(cmd);
std::transform(cmdString.begin(), cmdString.end(), cmdString.begin(), ::tolower);
std::copy_if(list.begin(), list.end(), retList.begin(), [&] (FilterPtr filter) {
std::string name = filter->getName();
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
if(name == cmdString) {
exactFilter = filter;
}
return name.compare(cmdString) == 0;
});
if(retList.empty()) return 0;
if(exactFilter != NULL) {
::notice("%s :: %s", exactFilter->getName().c_str(), exactFilter->getDescription().c_str());
snprintf(cmd, MAX_CMDLINE, "%s", exactFilter->getName().c_str());
return 1;
}
if(cmdString.empty()) {
notice("List available filters");
} else {
notice("List available filters with \"%s\"", cmd);
}
int c = 0;
char tmp[256];
std::for_each(retList.begin(), retList.end(), [&] (FilterPtr f) {
if(c % 4 == 0) {
if(c != 0) {
::act("%s", tmp);
}
tmp[0] = '\0';
}
strncat(tmp, "\t", sizeof(tmp) - 1);
strncat(tmp, f->getName().c_str(), sizeof(tmp) - 1);
++c;
});
return c;
}
示例10: filterPtr
void ClientStub::createFilterSequence(
std::vector<FilterPtr> & filters)
{
filters.clear();
// Setup compression if configured.
if (mEnableCompression)
{
#if RCF_FEATURE_ZLIB==1
FilterPtr filterPtr( new ZlibStatefulCompressionFilter() );
filters.push_back(filterPtr);
#else
RCF_ASSERT(0);
#endif
}
FilterPtr filterPtr;
if (mTransportProtocol != Tp_Clear && mTransportProtocol != Tp_Unspecified)
{
switch (mTransportProtocol)
{
#if RCF_FEATURE_SSPI==1
case Tp_Ntlm: filterPtr.reset( new NtlmFilter(this) ); break;
case Tp_Kerberos: filterPtr.reset( new KerberosFilter(this) ); break;
case Tp_Negotiate: filterPtr.reset( new NegotiateFilter(this) ); break;
#endif
#if RCF_FEATURE_OPENSSL==1 && RCF_FEATURE_SSPI==1
case Tp_Ssl: if (mSslImplementation == Si_Schannel)
{
filterPtr.reset( new SchannelFilter(this) );
}
else
{
RCF_ASSERT(mSslImplementation == Si_OpenSsl);
filterPtr.reset( new OpenSslEncryptionFilter(this) );
}
break;
#elif RCF_FEATURE_OPENSSL==1
case Tp_Ssl: filterPtr.reset( new OpenSslEncryptionFilter(this) ); break;
#elif RCF_FEATURE_SSPI==1
case Tp_Ssl: filterPtr.reset( new SchannelFilter(this) ); break;
#else
// Single case just to keep the compiler warnings quiet.
case Tp_Ssl:
#endif
default:
RCF_THROW( Exception( _RcfError_TransportProtocolNotSupported( getTransportProtocolName(mTransportProtocol)) ) );
}
}
if (filterPtr)
{
filters.push_back(filterPtr);
}
}
示例11: requestTransportFilters
void ClientStub::requestTransportFilters(FilterPtr filterPtr)
{
std::vector<FilterPtr> filters;
if (filterPtr.get())
{
filters.push_back(filterPtr);
}
requestTransportFilters(filters);
}
示例12: requestTransportFiltersAsync
void ClientStub::requestTransportFiltersAsync(
FilterPtr filterPtr,
boost::function0<void> onCompletion)
{
std::vector<FilterPtr> filters;
if (filterPtr.get())
{
filters.push_back(filterPtr);
}
requestTransportFiltersAsync(filters, onCompletion);
}
示例13: test15b
// Demonstrate rate limiting per importance level
void test15b(const DestinationPtr &sink1) {
banner("test15b - per importance rate limiting");
Facility log("test15b", sink1);
for (size_t i=DEBUG; i<=FATAL; ++i) {
Importance imp = (Importance)i;
FilterPtr limiter = TimeFilter::instance(1.0);
limiter->addDestination(log[imp].destination());
log[imp].destination(limiter);
}
for (size_t i=0; i<300000; ++i) {
log[DEBUG] <<"i=" <<i <<"\tdebugging message\n";
log[TRACE] <<"i=" <<i <<"\ttracing message\n";
log[WHERE] <<"i=" <<i <<"\tmajor execution point\n";
log[INFO] <<"i=" <<i <<"\tinformational message\n";
log[WARN] <<"i=" <<i <<"\twarning message\n";
log[ERROR] <<"i=" <<i <<"\terror message\n";
log[FATAL] <<"i=" <<i <<"\tfatal error message\n";
}
}
示例14: checkDocIdSetCacheable
static void checkDocIdSetCacheable(IndexReaderPtr reader, FilterPtr filter, bool shouldCacheable)
{
CachingWrapperFilterPtr cacher = newLucene<CachingWrapperFilter>(filter);
DocIdSetPtr originalSet = filter->getDocIdSet(reader);
DocIdSetPtr cachedSet = cacher->getDocIdSet(reader);
BOOST_CHECK(cachedSet->isCacheable());
BOOST_CHECK_EQUAL(shouldCacheable, originalSet->isCacheable());
if (originalSet->isCacheable())
BOOST_CHECK(MiscUtils::equalTypes(originalSet, cachedSet));
else
BOOST_CHECK(MiscUtils::typeOf<OpenBitSetDISI>(cachedSet));
}
示例15: sync
void AppenderSkeleton::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
{
synchronized sync(mutex);
if(closed)
{
LogLog::error(((LogString) LOG4CXX_STR("Attempted to append to closed appender named ["))
+ name + LOG4CXX_STR("]."));
return;
}
if(!isAsSevereAsThreshold(event->getLevel()))
{
return;
}
FilterPtr f = headFilter;
while(f != 0)
{
switch(f->decide(event))
{
case Filter::DENY:
return;
case Filter::ACCEPT:
f = 0;
break;
case Filter::NEUTRAL:
f = f->getNext();
}
}
append(event, pool1);
}