コード例 #1
0
ファイル: utilities.cpp プロジェクト: gcross/CodeSearch
//@+node:gcross.20110120115216.2090: *3* gatherCodes
template<unsigned int number_of_qubits, unsigned int number_of_operators> static set<Code> gatherCodesImpl(
      auto_ptr<OperatorSpace> initial_space
    , const bool ignore_solutions_with_trivial_columns
) {
    assert(number_of_qubits == initial_space->number_of_qubits);
    assert(number_of_operators == initial_space->number_of_operators);

    set<Code> codes;

    typedef static_qec<number_of_qubits,number_of_operators> qec_t;

    if(ignore_solutions_with_trivial_columns) {
        copy(
             generateSolutionsFor(initial_space)
                | filtered(hasNoTrivialColumns)
                | transformed(computeOptimizedCodeForOperatorSpace<qec_t>)
                | transformed(summarizeCode<qec_t>)
                | filtered(bind(&Code::isNonTrivial,_1,number_of_operators))
            ,inserter(codes,codes.end())
        );
    } else {
        copy(
             generateSolutionsFor(initial_space)
                | transformed(computeOptimizedCodeForOperatorSpace<qec_t>)
                | transformed(summarizeCode<qec_t>)
                | filtered(bind(&Code::isNonTrivial,_1,number_of_operators))
            ,inserter(codes,codes.end())
        );
    }

    return codes;
}
コード例 #2
0
ファイル: fchooser.c プロジェクト: barak/ivtools-cvs
void FileChooserImpl::load() {
    Directory& d = *dir_;
    FileBrowser& b = *fbrowser_;
    WidgetKit& kit = *kit_;
    kit.push_style();
    kit.style(style_);
    const LayoutKit& layout = *LayoutKit::instance();
    int dircount = d.count();
    delete filter_map_;
    int* index = new int[dircount];
    filter_map_ = index;
    for (int i = 0; i < dircount; i++) {
	const String& f = *d.name(i);
	boolean is_dir = d.is_directory(i);
	if ((is_dir && filtered(f, directory_filter_)) ||
	    (!is_dir && filtered(f, filter_))
	) {
	    Glyph* name = kit.label(f);
	    if (is_dir) {
		name = layout.hbox(name, kit.label("/"));
	    }
	    Glyph* label = new Target(
		layout.h_margin(name, 3.0, 0.0, 0.0, 15.0, fil, 0.0),
		TargetPrimitiveHit
	    );
	    TelltaleState* t = new TelltaleState(TelltaleState::is_enabled);
	    b.append_selectable(t);
	    b.append(new ChoiceItem(t, label, kit.bright_inset_frame(label)));
	    *index++ = i;
	}
    }
    b.refresh();
    kit.pop_style();
}
コード例 #3
0
void JsonChannelList::addChannel(cChannel* channel, std::string group, bool image)
{  
  if ( filtered() ) return;

  std::string suffix = (std::string) ".ts";

  SerChannel serChannel;
  serChannel.Name = StringExtension::UTF8Decode(channel->Name());
  serChannel.Number = channel->Number();
  serChannel.ChannelId = StringExtension::UTF8Decode((std::string)channel->GetChannelID().ToString());
  serChannel.Image = image;
  serChannel.Group = StringExtension::UTF8Decode(group);
  serChannel.Transponder = channel->Transponder();
  serChannel.Stream = StringExtension::UTF8Decode(((std::string)channel->GetChannelID().ToString() + (std::string)suffix).c_str());
  // TODO: There is an atsc Patch
  #if APIVERSNUM >= 10714
  serChannel.IsAtsc = channel->IsAtsc();
  #else
  serChannel.IsAtsc = false;
  #endif
  serChannel.IsCable = channel->IsCable();
  serChannel.IsSat = channel->IsSat();
  serChannel.IsTerr = channel->IsTerr();
  serChannel.IsRadio = VdrExtension::IsRadio(channel);
  serChannels.push_back(serChannel);
}
コード例 #4
0
void XmlChannelList::addChannel(cChannel* channel, std::string group, bool image)
{
  if ( filtered() ) return;

  std::string suffix = (std::string) ".ts";

  s->write(" <channel>\n");
  s->write(cString::sprintf("  <param name=\"name\">%s</param>\n", StringExtension::encodeToXml(channel->Name()).c_str()));
  s->write(cString::sprintf("  <param name=\"number\">%i</param>\n", channel->Number()));
  s->write(cString::sprintf("  <param name=\"channel_id\">%s</param>\n",  StringExtension::encodeToXml( (std::string)channel->GetChannelID().ToString()).c_str()));
  s->write(cString::sprintf("  <param name=\"image\">%s</param>\n", (image ? "true" : "false")));
  s->write(cString::sprintf("  <param name=\"group\">%s</param>\n", StringExtension::encodeToXml( group ).c_str()));
  s->write(cString::sprintf("  <param name=\"transponder\">%i</param>\n", channel->Transponder()));
  s->write(cString::sprintf("  <param name=\"stream\">%s</param>\n", StringExtension::encodeToXml( ((std::string)channel->GetChannelID().ToString() + (std::string)suffix).c_str()).c_str()));
  // TODO: There is an atsc Patch
  #if APIVERSNUM >= 10714
  s->write(cString::sprintf("  <param name=\"is_atsc\">%s</param>\n", channel->IsAtsc() ? "true" : "false"));
  #else
  s->write(cString::sprintf("  <param name=\"is_atsc\">%s</param>\n", false ? "true" : "false"));
  #endif
  s->write(cString::sprintf("  <param name=\"is_cable\">%s</param>\n", channel->IsCable() ? "true" : "false"));
  s->write(cString::sprintf("  <param name=\"is_sat\">%s</param>\n", channel->IsSat() ? "true" : "false"));
  s->write(cString::sprintf("  <param name=\"is_terr\">%s</param>\n", channel->IsTerr() ? "true" : "false"));
  bool is_radio = VdrExtension::IsRadio(channel);
  s->write(cString::sprintf("  <param name=\"is_radio\">%s</param>\n", is_radio ? "true" : "false"));
  s->write(" </channel>\n");
}
コード例 #5
0
pcl::PointCloud<MapCloudGenerator::PointT>::Ptr MapCloudGenerator::generate(const std::vector<KeyFrameSnapshot::Ptr>& keyframes, double resolution) const {
  if(keyframes.empty()) {
    return nullptr;
  }

  pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>());
  cloud->reserve(keyframes.front()->cloud->size() * keyframes.size());

  for(const auto& keyframe : keyframes) {
    Eigen::Matrix4f pose = keyframe->pose.matrix().cast<float>();
    for(const auto& src_pt : keyframe->cloud->points) {
      PointT dst_pt;
      dst_pt.getVector4fMap() = pose * src_pt.getVector4fMap();
      dst_pt.intensity = src_pt.intensity;
      cloud->push_back(dst_pt);
    }
  }

  cloud->width = cloud->size();
  cloud->height = 1;
  cloud->is_dense = false;

  pcl::octree::OctreePointCloud<PointT> octree(resolution);
  octree.setInputCloud(cloud);
  octree.addPointsFromInputCloud();

  pcl::PointCloud<PointT>::Ptr filtered(new pcl::PointCloud<PointT>());
  octree.getOccupiedVoxelCenters(filtered->points);

  filtered->width = filtered->size();
  filtered->height = 1;
  filtered->is_dense = false;

  return filtered;
}
コード例 #6
0
ImageColor WaterShedDecomposer::filterGaussSinglePass(ImageColor const & image, int r) const {
   r = std::max(1, r);
   int n = (r<<1) + 1;

   // create kernel
   unsigned long long * kernel = new unsigned long long[n];
   for (int i=0; i<r; ++i) {
      kernel[i] = kernel[n-i-1] = nCr(n-1, i);
   }
   kernel[r] = nCr(n-1, r);

   ImageColor filtered(image.height(), image.width());
   for (int y=0; y<image.height(); ++y) {
      for (int x=0; x<image.width(); ++x) {
         Color color;
         unsigned long long weights = 0;
         for (int i=0; i<n; ++i) {
            if (x-r+i >= 0 && x-r+i < image.width()) {
               color += image.at(x-r+i, y) * kernel[i];
               weights += kernel[i];
            }
         }
         filtered.at(y, x) = color / double(weights);
      }
   }

   delete[] kernel;

   return filtered;
}
コード例 #7
0
ファイル: BundleHooks.cpp プロジェクト: 01org/linux-sgx
void BundleHooks::FilterBundles(const BundleContext& context,
                                std::vector<Bundle>& bundles) const
{
  std::vector<ServiceRegistrationBase> srl;
  coreCtx->services.Get(us_service_interface_iid<BundleFindHook>(), srl);
  ShrinkableVector<Bundle> filtered(bundles);

  auto selfBundle = GetBundleContext().GetBundle();
  std::sort(srl.begin(), srl.end());
  for (auto srBaseIter = srl.rbegin(), srBaseEnd = srl.rend();
       srBaseIter != srBaseEnd;
       ++srBaseIter) {
    ServiceReference<BundleFindHook> sr = srBaseIter->GetReference();
    std::shared_ptr<BundleFindHook> fh =
      std::static_pointer_cast<BundleFindHook>(
        sr.d.load()->GetService(GetPrivate(selfBundle).get()));
    if (fh) {
      try {
        fh->Find(context, filtered);
      } catch (...) {
        std::string message("Failed to call Bundle FindHook  # " +
                            sr.GetProperty(Constants::SERVICE_ID).ToString());
        coreCtx->listeners.SendFrameworkEvent(
          FrameworkEvent(FrameworkEvent::Type::FRAMEWORK_WARNING,
                         selfBundle,
                         message,
                         std::current_exception()));
      }
    }
  }
}
コード例 #8
0
void set_field_text<edit_text_t>(edit_text_t& widget, const std::string& text)
{
    assert(widget.control_m);

    widget.type_2_debounce_m = true;

    std::string             filtered(text);
    std::string::size_type  pos(0);

    while (true)
    {
        pos = filtered.find('\n', pos);

        if (pos == std::string::npos) break;

        filtered.replace(pos, 1, "\r");
    }

    if (widget.scrollable_m)
        ADOBE_REQUIRE_STATUS(::TXNSetData(::HITextViewGetTXNObject(widget.control_m), kTXNTextData,
                                            filtered.c_str(), filtered.size(), kTXNStartOffset, kTXNEndOffset));
    else
        implementation::set_widget_data(widget.control_m,
                        kControlEntireControl, kControlEditTextCFStringTag,
                        explicit_cast<auto_cfstring_t>(filtered).get());

    widget.type_2_debounce_m = false;
}
コード例 #9
0
ファイル: usServiceHooks.cpp プロジェクト: 0r/MITK
void ServiceHooks::FilterServiceReferences(ModuleContext* mc, const std::string& service,
                                           const std::string& filter, std::vector<ServiceReferenceBase>& refs)
{
  std::vector<ServiceRegistrationBase> srl;
  coreCtx->services.Get_unlocked(us_service_interface_iid<ServiceFindHook>(), srl);
  if (!srl.empty())
  {
    ShrinkableVector<ServiceReferenceBase> filtered(refs);

    std::sort(srl.begin(), srl.end());
    for (std::vector<ServiceRegistrationBase>::reverse_iterator fhrIter = srl.rbegin(), fhrEnd = srl.rend();
         fhrIter != fhrEnd; ++fhrIter)
    {
      ServiceReference<ServiceFindHook> sr = fhrIter->GetReference();
      ServiceFindHook* const fh = reinterpret_cast<ServiceFindHook*>(sr.d->GetService(GetModuleContext()->GetModule()));
      if (fh != NULL)
      {
        try
        {
          fh->Find(mc, service, filter, filtered);
        }
        catch (const std::exception& e)
        {
          US_WARN << "Failed to call find hook  #" << sr.GetProperty(ServiceConstants::SERVICE_ID()).ToString()
                  << ": " << e.what();
        }
        catch (...)
        {
          US_WARN << "Failed to call find hook  #" << sr.GetProperty(ServiceConstants::SERVICE_ID()).ToString()
                  << ": unknown exception type";
        }
      }
    }
  }
}
コード例 #10
0
ファイル: usModuleHooks.cpp プロジェクト: Cdebus/MITK
void ModuleHooks::FilterModules(const ModuleContext* mc, std::vector<Module*>& modules) const
{
  std::vector<ServiceRegistrationBase> srl;
  coreCtx->services.Get(us_service_interface_iid<ModuleFindHook>(), srl);
  ShrinkableVector<Module*> filtered(modules);

  std::sort(srl.begin(), srl.end());
  for (std::vector<ServiceRegistrationBase>::reverse_iterator srBaseIter = srl.rbegin(), srBaseEnd = srl.rend();
       srBaseIter != srBaseEnd; ++srBaseIter)
  {
    ServiceReference<ModuleFindHook> sr = srBaseIter->GetReference();
    ModuleFindHook* const fh = reinterpret_cast<ModuleFindHook*>(sr.d->GetService(GetModuleContext()->GetModule()));
    if (fh != nullptr)
    {
      try
      {
        fh->Find(mc, filtered);
      }
      catch (const std::exception& e)
      {
        US_WARN << "Failed to call Module FindHook  #" << sr.GetProperty(ServiceConstants::SERVICE_ID()).ToString()
                << ": " << e.what();
      }
      catch (...)
      {
        US_WARN << "Failed to call Module FindHook  #" << sr.GetProperty(ServiceConstants::SERVICE_ID()).ToString()
                << ": unknown exception type";
      }
    }
  }
}
コード例 #11
0
void HtmlChannelList::addChannel(cChannel* channel, std::string group, bool image)
{
  if ( filtered() ) return;

  s->write("<li>");
  s->write((char*)channel->Name());
  s->write("\n");
}
コード例 #12
0
void HtmlChannelGroupList::addGroup(std::string group)
{
  if ( filtered() ) return;

  s->write("<li>");
  s->write(group.c_str());
  s->write("\n");
}
コード例 #13
0
std::vector<Document> Documents::dirtyAndVisibleButNotCurrentDocuments() const
{
    return filtered([](const Document &document) {
        return document.isNeedingReparse()
            && document.isVisibleInEditor()
            && !document.isUsedByCurrentEditor();
    });
}
コード例 #14
0
ファイル: syscall.c プロジェクト: masatake/strace
void
syscall_entering_finish(struct tcb *tcp, int res)
{
	tcp->flags |= TCB_INSYSCALL;
	tcp->sys_func_rval = res;
	/* Measure the entrance time as late as possible to avoid errors. */
	if ((Tflag || cflag) && !filtered(tcp))
		gettimeofday(&tcp->etime, NULL);
}
コード例 #15
0
 // initialize the stencil of hash offsets
 // boil this info further down to contiguous stretches?
 ndarray<fixed_t> compute_offsets(ndarray<fixed_t, 2> stencil) const {
     auto arr = ndarray_from_iterable(
         stencil.view<cell_t>()
             | transformed([&](cell_t c){return hash_from_cell(c);})
             | filtered([&](fixed_t h){return h > 0;})
             );
     boost::sort(arr);
     return arr;
 }
コード例 #16
0
ファイル: animelistwidget.cpp プロジェクト: NotLemon/Shinjiru
void AnimeListWidget::filter(const QMap<QString, QString> &t_tokens) {
    m_proxy_model->setProxyFilters(t_tokens);
    m_proxy_model->invalidate();

    if (m_proxy_model->rowCount() == 0 && m_model->rowCount() > 0) {
        emit emptyResults();
    } else {
        emit filtered();
    }
}
コード例 #17
0
ファイル: symchoos.cpp プロジェクト: bhache/pkg-neuron
void SymChooserImpl::load(int bindex) {
    SymDirectory& d = *dir_[bindex];
    Browser& b = *fbrowser_[bindex];
    WidgetKit& kit = *kit_;
    kit.push_style();
    kit.style(style_);
    const LayoutKit& layout = *LayoutKit::instance();
    int dircount = d.count();
    delete [] filter_map_;
    int* index = new int[dircount];
    filter_map_ = index;
//printf("loading %d\n", bindex);
    for (int i = 0; i < dircount; i++) {
	const String& f = d.name(i);
	boolean is_dir = d.is_directory(i);
	if ((is_dir && filtered(f, directory_filter_)) ||
	    (!is_dir && filtered(f, filter_))
	) {
	    Glyph* name = kit.label(f);
	    if (is_dir) {
		if (d.symbol(i) && d.symbol(i)->type == TEMPLATE) {
			name = layout.hbox(name, kit.label("_"));
		}else{
			name = layout.hbox(name, kit.label("."));
		}
	    }
	    Glyph* label = new Target(
		layout.h_margin(name, 3.0, 0.0, 0.0, 15.0, fil, 0.0),
		TargetPrimitiveHit
	    );
	    TelltaleState* t = new TelltaleState(TelltaleState::is_enabled);
	    b.append_selectable(t);
	    b.append(new ChoiceItem(t, label, kit.bright_inset_frame(label)));
	    *index++ = i;
	}
    }
    // the order of the following two statements is important for carbon
    // to avoid a premature browser request which ends up showing an
    // empty list.
    fbrowser_[bindex]->refresh();
    editor_->field(d.path());
    kit.pop_style();
}
コード例 #18
0
void XmlRecordingList::addRecording(cRecording* recording, int nr)
{
  if ( filtered() ) return;

  std::string eventTitle = "";
  std::string eventShortText = "";
  std::string eventDescription = "";
  int eventStartTime = -1;
  int eventDuration = -1;

  cEvent* event = (cEvent*)recording->Info()->GetEvent();

  if ( event != NULL )
  {
     if ( event->Title() ) { eventTitle = event->Title(); }
     if ( event->ShortText() ) { eventShortText = event->ShortText(); }
     if ( event->Description() ) { eventDescription = event->Description(); }
     if ( event->StartTime() > 0 ) { eventStartTime = event->StartTime(); }
     if ( event->Duration() > 0 ) { eventDuration = event->Duration(); }
  }

  s->write(" <recording>\n");
  s->write(cString::sprintf("  <param name=\"number\">%i</param>\n", nr));
  s->write(cString::sprintf("  <param name=\"name\">%s</param>\n", StringExtension::encodeToXml(recording->Name()).c_str()) );
  s->write(cString::sprintf("  <param name=\"filename\">%s</param>\n", StringExtension::encodeToXml(recording->FileName()).c_str()) );
  s->write(cString::sprintf("  <param name=\"relative_filename\">%s</param>\n", StringExtension::encodeToXml(VdrExtension::getRelativeVideoPath(recording).c_str()).c_str()));
  s->write(cString::sprintf("  <param name=\"is_new\">%s</param>\n", recording->IsNew() ? "true" : "false" ));
  s->write(cString::sprintf("  <param name=\"is_edited\">%s</param>\n", recording->IsEdited() ? "true" : "false" ));

  #if APIVERSNUM >= 10703
  s->write(cString::sprintf("  <param name=\"is_pes_recording\">%s</param>\n", recording->IsPesRecording() ? "true" : "false" ));
  s->write(cString::sprintf("  <param name=\"frames_per_second\">%f</param>\n", recording->FramesPerSecond()));
  #else
  s->write(cString::sprintf("  <param name=\"is_pes_recording\">%s</param>\n", true ? "true" : "false" ));
  s->write(cString::sprintf("  <param name=\"frames_per_second\">%i</param>\n", FRAMESPERSEC));
  #endif

  s->write(cString::sprintf("  <param name=\"duration\">%i</param>\n", VdrExtension::RecordingLengthInSeconds(recording)));

  if (read_marks) {
     s->write("  <param name=\"marks\">\n");
     std::vector< std::string > marks = VdrMarks::get()->readMarks(recording);
     for(int i=0;i<(int)marks.size();i++) {
        s->write(cString::sprintf("   <mark>%s</mark>\n", marks[i].c_str()));
     }
     s->write("  </param>\n");
  } 

  s->write(cString::sprintf("  <param name=\"event_title\">%s</param>\n", StringExtension::encodeToXml(eventTitle).c_str()) );
  s->write(cString::sprintf("  <param name=\"event_short_text\">%s</param>\n", StringExtension::encodeToXml(eventShortText).c_str()) );
  s->write(cString::sprintf("  <param name=\"event_description\">%s</param>\n", StringExtension::encodeToXml(eventDescription).c_str()) );
  s->write(cString::sprintf("  <param name=\"event_start_time\">%i</param>\n", eventStartTime));
  s->write(cString::sprintf("  <param name=\"event_duration\">%i</param>\n", eventDuration));
  s->write(" </recording>\n");
}
コード例 #19
0
void JsonRecordingList::addRecording(cRecording* recording, int nr)
{
  if ( filtered() ) return;

  cxxtools::String empty = StringExtension::UTF8Decode("");
  cxxtools::String eventTitle = empty;
  cxxtools::String eventShortText = empty;
  cxxtools::String eventDescription = empty;
  int eventStartTime = -1;
  int eventDuration = -1;

  cEvent* event = (cEvent*)recording->Info()->GetEvent();

  if ( event != NULL )
  {
     if ( event->Title() ) { eventTitle = StringExtension::UTF8Decode(event->Title()); }
     if ( event->ShortText() ) { eventShortText = StringExtension::UTF8Decode(event->ShortText()); }
     if ( event->Description() ) { eventDescription = StringExtension::UTF8Decode(event->Description()); }
     if ( event->StartTime() > 0 ) { eventStartTime = event->StartTime(); }
     if ( event->Duration() > 0 ) { eventDuration = event->Duration(); }
  }

  SerRecording serRecording;
  serRecording.Number = nr;
  serRecording.Name = StringExtension::UTF8Decode(recording->Name());
  serRecording.FileName = StringExtension::UTF8Decode(recording->FileName());
  serRecording.RelativeFileName = StringExtension::UTF8Decode(VdrExtension::getRelativeVideoPath(recording).c_str());
  serRecording.IsNew = recording->IsNew();
  serRecording.IsEdited = recording->IsEdited();

  #if APIVERSNUM >= 10703
  serRecording.IsPesRecording = recording->IsPesRecording();
  serRecording.FramesPerSecond = recording->FramesPerSecond();
  #else
  serRecording.IsPesRecording = true;
  serRecording.FramesPerSecond = FRAMESPERSEC;
  #endif

  serRecording.Duration = VdrExtension::RecordingLengthInSeconds(recording);
  serRecording.EventTitle = eventTitle;
  serRecording.EventShortText = eventShortText;
  serRecording.EventDescription = eventDescription;
  serRecording.EventStartTime = eventStartTime;
  serRecording.EventDuration = eventDuration;

  SerMarks serMarks;
  if (read_marks) {
     serMarks.marks = VdrMarks::get()->readMarks(recording);
  }

  serRecording.Marks = serMarks;

  serRecordings.push_back(serRecording);
}
コード例 #20
0
void PointCloud2Display::processMessage( const sensor_msgs::PointCloud2ConstPtr& cloud )
{
  // Filter any nan values out of the cloud.  Any nan values that make it through to PointCloudBase
  // will get their points put off in lala land, but it means they still do get processed/rendered
  // which can be a big performance hit
  sensor_msgs::PointCloud2Ptr filtered(new sensor_msgs::PointCloud2);
  int32_t xi = findChannelIndex(cloud, "x");
  int32_t yi = findChannelIndex(cloud, "y");
  int32_t zi = findChannelIndex(cloud, "z");

  if (xi == -1 || yi == -1 || zi == -1)
  {
    return;
  }

  const uint32_t xoff = cloud->fields[xi].offset;
  const uint32_t yoff = cloud->fields[yi].offset;
  const uint32_t zoff = cloud->fields[zi].offset;
  const uint32_t point_step = cloud->point_step;
  const size_t point_count = cloud->width * cloud->height;
  filtered->data.resize(cloud->data.size());
  if (point_count == 0)
  {
    return;
  }

  uint32_t output_count = 0;
  const uint8_t* ptr = &cloud->data.front();
  for (size_t i = 0; i < point_count; ++i)
  {
    float x = *reinterpret_cast<const float*>(ptr + xoff);
    float y = *reinterpret_cast<const float*>(ptr + yoff);
    float z = *reinterpret_cast<const float*>(ptr + zoff);
    if (validateFloats(Ogre::Vector3(x, y, z)))
    {
      memcpy(&filtered->data.front() + (output_count * point_step), ptr, point_step);
      ++output_count;
    }

    ptr += point_step;
  }

  filtered->header = cloud->header;
  filtered->fields = cloud->fields;
  filtered->data.resize(output_count * point_step);
  filtered->height = 1;
  filtered->width = output_count;
  filtered->is_bigendian = cloud->is_bigendian;
  filtered->point_step = point_step;
  filtered->row_step = output_count;

  point_cloud_common_->addMessage( filtered );
}
コード例 #21
0
ファイル: syscall.c プロジェクト: masatake/strace
/* Returns:
 * 0: "bail out".
 * 1: ok.
 * -1: error in one of ptrace ops.
 *
 * If not 0, call syscall_exiting_trace(tcp, res), where res is the return
 *    value. Anyway, call syscall_exiting_finish(tcp) then.
 */
int
syscall_exiting_decode(struct tcb *tcp, struct timeval *ptv)
{
	/* Measure the exit time as early as possible to avoid errors. */
	if ((Tflag || cflag) && !(filtered(tcp) || hide_log(tcp)))
		gettimeofday(ptv, NULL);

#ifdef USE_LIBUNWIND
	if (stack_trace_enabled) {
		if (tcp->s_ent->sys_flags & STACKTRACE_INVALIDATE_CACHE)
			unwind_cache_invalidate(tcp);
	}
#endif

	if (filtered(tcp) || hide_log(tcp))
		return 0;

	get_regs(tcp->pid);
#if SUPPORTED_PERSONALITIES > 1
	update_personality(tcp, tcp->currpers);
#endif
	return get_regs_error ? -1 : get_syscall_result(tcp);
}
コード例 #22
0
void tmp_create_game::on_filter_change(twindow& window, const std::string& id)
{
	create_engine_.apply_level_filter(find_widget<widget>(&window, id, false).get_value());

	tlistbox& game_list = find_widget<tlistbox>(&window, "games_list", false);

	std::vector<bool> filtered(game_list.get_item_count());
	for(const size_t i : create_engine_.get_filtered_level_indices(create_engine_.current_level_type())) {
		filtered[i] = true;
	}

	game_list.set_row_shown(filtered);

	update_details(window);
}
コード例 #23
0
/*!
 * @brief メソッドPointCloudMethod::passThroughFilter().パススルーフィルター
 * @param pcl::PointCloud<pcl::PointXYZ>::Ptr inputPointCloud
 * @return pcl::PointCloud<pcl::PointXYZ>::Ptr filtered
 */
pcl::PointCloud<pcl::PointXYZRGB>::Ptr PointCloudMethod::passThroughFilter(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &inputPointCloud)
{
	cout << "before PassThroughFilter => " << inputPointCloud->size() << endl;

	pcl::PointCloud<pcl::PointXYZRGB>::Ptr filtered(new pcl::PointCloud<pcl::PointXYZRGB>()); //フィルター後用のポイントクラウド
	pcl::PassThrough<pcl::PointXYZRGB> pt;
	pt.setInputCloud(inputPointCloud);
	pt.setFilterFieldName("z");
	pt.setFilterLimits(0, 30);
	pt.filter(*filtered);

	
	cout << "after PassThroughFilter => " << filtered->size() << endl;
	return filtered;
}
コード例 #24
0
ファイル: pclManager.cpp プロジェクト: yanik-porto/3DfromTOF
pcl::PointCloud<pcl::PointXYZI>::Ptr pclManager::filter_cloud(pcl::PointCloud<pcl::PointXYZI>::Ptr ptcloud, const float &threshX, const float &threshY, const float &threshZ, const float &threshI)
{
    pcl::PointCloud<pcl::PointXYZI>::Ptr filtered(new pcl::PointCloud<pcl::PointXYZI>);

    //Filter the input cloud with the given values for the 3 coordinates and the intensity
    for (size_t i = 0; i < ptcloud->points.size(); ++i)
    {
         if ((ptcloud->points[i].intensity>threshI)&&(ptcloud->points[i].z<(threshZ))&&(ptcloud->points[i].y<threshY) && (ptcloud->points[i].y>-threshY) && (ptcloud->points[i].x<threshX) && (ptcloud->points[i].x>-threshX))
            filtered->push_back(ptcloud->at(i));
    }

    std::cout << "Filtering " << ptcloud->size() <<" points results in " << filtered->size() << "points" << std::endl;

    return filtered;
}
コード例 #25
0
/*!
 * @brief メソッドPointCloudMethod::radiusOutlierRemoval().外れ値を除去するメソッド(c60)
 * @param pcl::PointCloud<pcl::PointXYZ>::Ptr inputPointCloud
 * @return pcl::PointCloud<pcl::PointXYZ>::Ptr filtered
 */
pcl::PointCloud<pcl::PointXYZRGB>::Ptr PointCloudMethod::radiusOutlierRemoval(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &inputPointCloud)
{
	cout << "before RadiusOutlierRemoval => " << inputPointCloud->size() << endl;

	pcl::PointCloud<pcl::PointXYZRGB>::Ptr filtered(new pcl::PointCloud<pcl::PointXYZRGB>()); //フィルタリング後用のポイントクラウドを宣言
	pcl::RadiusOutlierRemoval<pcl::PointXYZRGB> ror;

	ror.setInputCloud(inputPointCloud);
	cout << "before RadiusOutlierRemoval => " << inputPointCloud->size() << endl;

	ror.setRadiusSearch(0.8);
	ror.setMinNeighborsInRadius(2);
	ror.filter(*filtered);

	cout << "after RadiusOutlierRemoval => " << filtered->size() << endl;
	return filtered;
}
コード例 #26
0
/*!
 * @brief メソッドPointCloudMethod::removeOutlier().外れ値を除去するメソッド(c59)
 * @param pcl::PointCloud<pcl::PointXYZ>::Ptr inputPointCloud
 * @return pcl::PointCloud<pcl::PointXYZ>::Ptr filtered
 */
pcl::PointCloud<pcl::PointXYZRGB>::Ptr PointCloudMethod::removeOutlier(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &inputPointCloud)
{
	cout << "before Remove Outlier => " << inputPointCloud->size() << endl;

	pcl::PointCloud<pcl::PointXYZRGB>::Ptr filtered(new pcl::PointCloud<pcl::PointXYZRGB>()); //フィルタリング後用のポイントクラウドを宣言
	pcl::StatisticalOutlierRemoval<pcl::PointXYZRGB> fl;
	
	fl.setInputCloud(inputPointCloud);
	fl.setMeanK(50);
	fl.setStddevMulThresh(0.1);
	fl.setNegative(false);
	cout << "TEST" << endl;
	fl.filter(*filtered);

	cout << "after Remove Outlier => " << filtered->size() << endl;
	return filtered;
}
コード例 #27
0
ファイル: main.cpp プロジェクト: CCJY/coliru
int main()
{
    std::map<int, int> my_map;
    my_map[1] = 11;
    my_map[2] = 22;
    my_map[3] = 33;
    my_map[4] = 44;
    my_map[5] = 55;
    
    std::vector<int> target;
    copy(my_map | map_values | filtered(is_odd) | reversed, std::back_inserter(target));
    
    for (auto & t : target)
    {
        std::cout << t << std::endl;
    }
}
コード例 #28
0
///
/// \brief Vespucci::Math::Smoothing::MedianFilter
/// \param X
/// \param window_size
/// \return
/// Performs median filtering on a signal X. This just ignores the edges becuause
/// they will be fairly small and not very interesting.
arma::vec Vespucci::Math::Smoothing::MedianFilter(const arma::vec &X, arma::uword window_size)
{
    arma::uword k = (window_size - 1) / 2;

    arma::vec filtered = X; //copy the whole thing, then add in the bit we actually filter
    arma::vec buffer;
    try{
        // middle part of spectrum
        for (arma::uword i = k; i < (X.n_rows - k); ++i){
            buffer = X.subvec(i-k, i+k);
            filtered(i) = arma::median(buffer);
        }
    }catch(std::exception e){
        std::cout << e.what();
    }

    return filtered;
}
コード例 #29
0
/*!
 * @brief メソッドPointCloudMethod::downSamplingUsingVoxelGridFilter().ダウンサンプリング処理を行うメソッド(c59)
 * @param pcl::PointCloud<pcl::PointXYZ>::Ptr inputPointCloud
 * @return pcl::PointCloud<pcl::PointXYZ>::Ptr filtered
 */
pcl::PointCloud<pcl::PointXYZRGB>::Ptr PointCloudMethod::downSamplingUsingVoxelGridFilter(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &inputPointCloud, float leafSizeX, float leafSizeY, float leafSizeZ)
{
	cout << "before Voxel Grid Filter => " << inputPointCloud->size() << endl;

	pcl::PointCloud<pcl::PointXYZRGB>::Ptr filtered(new pcl::PointCloud<pcl::PointXYZRGB>()); //フィルタリング後用のポイントクラウドを宣言
	pcl::VoxelGrid<pcl::PointXYZRGB> vg;

	vg.setInputCloud(inputPointCloud);
	//sor.setLeafSize()でダウンサンプリングの程度を変更
	vg.setLeafSize(leafSizeX, leafSizeY, leafSizeZ);
	//vg.setLeafSize(0.003f, 0.003f, 0.003f); //Default
	//sor.setLeafSize(0.03f, 0.03f, 0.03f); //少ない
	vg.filter(*filtered);

	//ポイントクラウドをしっかり保持できているかサイズを確認
	//cout << "inputSIZE => " << inputPointCloud->size() << endl; //入力したポイントクラウドのサイズ
	cout << "after Voxel Grid Filter => " << filtered->size() << endl; //出力されるポイントクラウドのサイズ
	return filtered;
}
コード例 #30
0
	void conditionArticulation(boost::shared_array<vertexState> state, mpfr_class& weight, const context& contextObj, std::vector<int>& scratch, boost::detail::depth_first_visit_restricted_impl_helper<filteredGraphType>::stackType& filteredGraphStack)
	{
		const context::inputGraph& graph = contextObj.getGraph();
		filteredGraphType filtered(graph, boost::keep_all(), filterByStateMask(state.get(), UNFIXED_MASK | ON_MASK));
		//get out biconnected components of helper graph (which has different vertex ids, remember)
		std::vector<std::size_t> articulationVertices;
		boost::articulation_points(filtered, std::back_inserter(articulationVertices));
	
		typedef boost::color_traits<boost::default_color_type> Color;
		std::vector<boost::default_color_type> colorMap(boost::num_vertices(contextObj.getGraph()), Color::white());
		findFixedOnVisitor fixedVisitor(state.get());
		const std::vector<mpfr_class> operationalProbabilities = contextObj.getOperationalProbabilities();

		for(std::vector<std::size_t>::iterator i = articulationVertices.begin(); i != articulationVertices.end(); i++)
		{
			if(state[*i].state != FIXED_ON)
			{
				std::fill(colorMap.begin(), colorMap.end(), Color::white());
				colorMap[*i] = Color::black();

				filteredGraphType::out_edge_iterator current, end;
				boost::tie(current, end) = boost::out_edges(*i, filtered);
				int nComponentsWithFixedOnVertices = 0;
				for(; current != end; current++)
				{
					std::size_t otherVertex = current->m_target;
					if(colorMap[otherVertex] != Color::black())
					{
						fixedVisitor.found = false;
						boost::detail::depth_first_visit_restricted_impl(filtered, otherVertex, fixedVisitor, &(colorMap[0]), filteredGraphStack, boost::detail::nontruth2());
						if(fixedVisitor.found) nComponentsWithFixedOnVertices++;
						if(nComponentsWithFixedOnVertices > 1) break;
					}
				}
				if(nComponentsWithFixedOnVertices > 1)
				{
					state[*i].state = FIXED_ON;
					weight *= operationalProbabilities[*i];
				}
			}
		}
	}