• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ receiver函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中receiver函数的典型用法代码示例。如果您正苦于以下问题:C++ receiver函数的具体用法?C++ receiver怎么用?C++ receiver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了receiver函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FWI_PSV


//.........这里部分代码省略.........
while ((i=fgetc(FP_stage)) != EOF)
if (i=='\n') ++stagemax;
rewind(FP_stage);
stagemax--;
fclose(FP_stage);

/* define data structures for PSV problem */
struct wavePSV;
struct wavePSV_PML;
struct matPSV;
struct fwiPSV;
struct mpiPSV;
struct seisPSV;
struct seisPSVfwi;
struct acq;

nd = FDORDER/2 + 1;
fdo3 = 2*nd;
buffsize=2.0*2.0*fdo3*(NX +NY)*sizeof(MPI_FLOAT);

/* allocate buffer for buffering messages */
buff_addr=malloc(buffsize);
if (!buff_addr) err("allocation failure for buffer for MPI_Bsend !");
MPI_Buffer_attach(buff_addr,buffsize);

/* allocation for request and status arrays */
req_send=(MPI_Request *)malloc(REQUEST_COUNT*sizeof(MPI_Request));
req_rec=(MPI_Request *)malloc(REQUEST_COUNT*sizeof(MPI_Request));
send_statuses=(MPI_Status *)malloc(REQUEST_COUNT*sizeof(MPI_Status));
rec_statuses=(MPI_Status *)malloc(REQUEST_COUNT*sizeof(MPI_Status));

/* --------- add different modules here ------------------------ */
ns=NT;	/* in a FWI one has to keep all samples of the forward modeled data
	at the receiver positions to calculate the adjoint sources and to do 
	the backpropagation; look at function saveseis_glob.c to see that every
	NDT sample for the forward modeled wavefield is written to su files*/

if (SEISMO){

   acq.recpos=receiver(FP, &ntr, ishot);
   acq.recswitch = ivector(1,ntr);
   acq.recpos_loc = splitrec(acq.recpos,&ntr_loc, ntr, acq.recswitch);
   ntr_glob=ntr;
   ntr=ntr_loc;
   
   if(N_STREAMER>0){
     free_imatrix(acq.recpos,1,3,1,ntr_glob);
     if(ntr>0) free_imatrix(acq.recpos_loc,1,3,1,ntr);
     free_ivector(acq.recswitch,1,ntr_glob);
   }
   
}

if(N_STREAMER==0){

   /* Memory for seismic data */
   alloc_seisPSV(ntr,ns,&seisPSV);

   /* Memory for FWI seismic data */ 
   alloc_seisPSVfwi(ntr,ntr_glob,ns,&seisPSVfwi);

}

/* Memory for full data seismograms */
alloc_seisPSVfull(&seisPSV,ntr_glob);
开发者ID:linbinzhang,项目名称:DENISE-Black-Edition,代码行数:66,代码来源:FWI_PSV.c


示例2: main

int
main(int argc, char *argv[])
{
	struct sigaction sa;
	struct msqid_ds m_ds;
	struct test_mymsg m;
	sigset_t sigmask;

	if (argc != 2)
		usage();

	/*
	 * Install a SIGSYS handler so that we can exit gracefully if
	 * System V Message Queue support isn't in the kernel.
	 */
	sa.sa_handler = sigsys_handler;
	sigemptyset(&sa.sa_mask);
	sa.sa_flags = 0;
	if (sigaction(SIGSYS, &sa, NULL) == -1)
		err(1, "sigaction SIGSYS");

	/*
	 * Install and SIGCHLD handler to deal with all possible exit
	 * conditions of the receiver.
	 */
	sa.sa_handler = sigchld_handler;
	sigemptyset(&sa.sa_mask);
	sa.sa_flags = 0;
	if (sigaction(SIGCHLD, &sa, NULL) == -1)
		err(1, "sigaction SIGCHLD");

	msgkey = ftok(argv[1], 4160);

	/*
	 * Initialize child_pid to ourselves to that the cleanup function
	 * works before we create the receiver.
	 */
	child_pid = getpid();

	/*
	 * Make sure that when the sender exits, the message queue is
	 * removed.
	 */
	if (atexit(cleanup) == -1)
		err(1, "atexit");

	if ((sender_msqid = msgget(msgkey, IPC_CREAT | 0640)) == -1)
		err(1, "msgget");

	if (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1)
		err(1, "msgctl IPC_STAT");

	print_msqid_ds(&m_ds, 0640);

	m_ds.msg_perm.mode = (m_ds.msg_perm.mode & ~0777) | 0600;

	if (msgctl(sender_msqid, IPC_SET, &m_ds) == -1)
		err(1, "msgctl IPC_SET");

	bzero(&m_ds, sizeof m_ds);

	if (msgctl(sender_msqid, IPC_STAT, &m_ds) == -1)
		err(1, "msgctl IPC_STAT");

	if ((m_ds.msg_perm.mode & 0777) != 0600)
		err(1, "IPC_SET of mode didn't hold");

	print_msqid_ds(&m_ds, 0600);

	switch ((child_pid = fork())) {
	case -1:
		err(1, "fork");
		/* NOTREACHED */

	case 0:
		receiver();
		break;

	default:
		break;
	}

	/*
	 * Send the first message to the receiver and wait for the ACK.
	 */
	m.mtype = MTYPE_1;
	strcpy(m.mtext, m1_str);
	if (msgsnd(sender_msqid, &m, strlen(m1_str) + 1, 0) == -1)
		err(1, "sender: msgsnd 1");

	if (msgrcv(sender_msqid, &m, sizeof(m.mtext), MTYPE_1_ACK, 0) !=
	    strlen(m1_str) + 1)
		err(1, "sender: msgrcv 1 ack");

	print_msqid_ds(&m_ds, 0600);

	/*
	 * Send the second message to the receiver and wait for the ACK.
	 */
	m.mtype = MTYPE_2;
//.........这里部分代码省略.........
开发者ID:varanasisaigithub,项目名称:freebsd-1,代码行数:101,代码来源:msgtest.c


示例3: qDebug

void MyIrcBuffer::on_noticeReceived(const QString& origin, const QString& notice, Irc::Buffer::MessageFlags flags)
{
    qDebug() << "notice received:" << receiver() << origin << notice
             << (flags & Irc::Buffer::IdentifiedFlag ? "(identified!)" : "(not identified)");
}
开发者ID:Aico,项目名称:mudlet,代码行数:5,代码来源:session.cpp


示例4: extract_classes_from_manifest

/*
 * Parse AndroidManifest from buffer, return a list of class names that are referenced
 */
std::unordered_set<std::string> extract_classes_from_manifest(const std::string& manifest_contents) {

  // Tags
  android::String16 activity("activity");
  android::String16 activity_alias("activity-alias");
  android::String16 application("application");
  android::String16 provider("provider");
  android::String16 receiver("receiver");
  android::String16 service("service");
  android::String16 instrumentation("instrumentation");

  // Attributes
  android::String16 authorities("authorities");
  android::String16 name("name");
  android::String16 target_activity("targetActivity");

  android::ResXMLTree parser;
  parser.setTo(manifest_contents.data(), manifest_contents.size());

  std::unordered_set<std::string> result;

  if (parser.getError() != android::NO_ERROR) {
    return result;
  }

  android::ResXMLParser::event_code_t type;
  do {
    type = parser.next();
    if (type == android::ResXMLParser::START_TAG) {
      size_t len;
      android::String16 tag(parser.getElementName(&len));
      if (tag == activity ||
          tag == application ||
          tag == provider ||
          tag == receiver ||
          tag == service ||
          tag == instrumentation) {

        std::string classname = get_attribute_value(parser, name);
        if (classname.size()) {
          result.insert(dotname_to_dexname(classname));
        }

        if (tag == provider) {
          std::string text = get_attribute_value(parser, authorities);
          size_t start = 0;
          size_t end = 0;
          while ((end = text.find(';', start)) != std::string::npos) {
              result.insert(dotname_to_dexname(text.substr(start, end - start)));
              start = end + 1;
          }
          result.insert(dotname_to_dexname(text.substr(start)));
        }
      } else if (tag == activity_alias) {
        std::string classname = get_attribute_value(parser, target_activity);
        if (classname.size()) {
          result.insert(dotname_to_dexname(classname));
        }
      }
    }
  } while (type != android::ResXMLParser::BAD_DOCUMENT &&
           type != android::ResXMLParser::END_DOCUMENT);

  return result;
}
开发者ID:272152441,项目名称:redex,代码行数:68,代码来源:RedexResources.cpp


示例5: createDevice

bool Tutorial12::Run()
{
    IrrlichtDevice *device = createDevice(video::EDT_OPENGL, dimension2d<u32>(180,120), 16, false, false, false, 0);

    if(device==0)
    {
        return false;
    }

    video::IVideoDriver* driver = device->getVideoDriver();
    scene::ISceneManager* smgr = device->getSceneManager();
    gui::IGUIEnvironment* env = device->getGUIEnvironment();

    driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

    env->addImage(driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlichtlogo2.png"), core::position2d<s32>(10,10));
    env->getSkin()->setFont(env->getFont("../irrlicht/irrlicht-1.7.3/media/fontlucida.png"));
    scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0,100.0f, 1.2f);

    camera->setPosition(core::vector3df(2700*2, 255*2, 2600*2));
    camera->setTarget(core::vector3df(2397*2, 343*2, 2700*2));
    camera->setFarValue(42000.0f);

    device->getCursorControl()->setVisible(false);

    scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode("../irrlicht/irrlicht-1.7.3/media/terrain-heightmap.bmp",
                                                                    0,                                      // parent node                                      // parent node
                                                                    -1,                                     // node id
                                                                    core::vector3df(0.f, 0.f, 0.f),         // position
                                                                    core::vector3df(0.f, 0.f, 0.f),         // rotation
                                                                    core::vector3df(40.f, 4.4f, 40.f),      // scale
                                                                    video::SColor ( 255, 255, 255, 255 ),   // vertexColor
                                                                    5,                                      // maxLOD
                                                                    scene::ETPS_17,                         // patchSize
                                                                    4);                                       // smoothFactor

    terrain->setMaterialFlag(video::EMF_LIGHTING, false);
    terrain->setMaterialTexture(0, driver->getTexture("../irrlicht/irrlicht-1.7.3/media/terrain-texture.jpg"));
    terrain->setMaterialTexture(1, driver->getTexture("../irrlicht/irrlicht-1.7.3/media/detailmap3.jpg"));
    terrain->setMaterialType(video::EMT_DETAIL_MAP);
    terrain->scaleTexture(1.0f, 20.0f);

    //collision
    scene::ITriangleSelector* selector = smgr->createTerrainTriangleSelector(terrain,0);
    terrain->setTriangleSelector(selector);

    scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, camera, core::vector3df(60,100,60), core::vector3df(0,0,0), core::vector3df(0,50,0));
    selector->drop();
    camera->addAnimator(anim);
    anim->drop();


    //add collision responder to camera, i.e. gravity!
    anim = smgr->createCollisionResponseAnimator(
                        selector, camera, core::vector3df(10,20,10),
                        core::vector3df(0,-5,0), core::vector3df(0,30,0));
                selector->drop(); // As soon as we're done with the selector, drop it.
                camera->addAnimator(anim);
                anim->drop();  // And likewise, drop the animator when we're done referring to it.

    //to access terrain data, do this!
    scene::CDynamicMeshBuffer* buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT);
    terrain->getMeshBufferForLOD(*buffer, 0);
    video::S3DVertex2TCoords* data = (video::S3DVertex2TCoords*)buffer->getVertexBuffer().getData();
    //work on data or get the IndexBuffer with a similar call
    buffer->drop();


    //create skybox and skydome
    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
    scene::ISceneNode* skybox = smgr->addSkyBoxSceneNode(
        driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlicht2_up.jpg"),
        driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlicht2_dn.jpg"),
        driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlicht2_lf.jpg"),
        driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlicht2_rt.jpg"),
        driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlicht2_ft.jpg"),
        driver->getTexture("../irrlicht/irrlicht-1.7.3/media/irrlicht2_bk.jpg"));
    scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../irrlicht/irrlicht-1.7.3/media/skydome.jpg"),16,8,0.95f, 2.0f);

    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

    //event receiver
    MyEventReceiver12 receiver(terrain, skybox, skydome);
    device->setEventReceiver(&receiver);

    int lastFPS = -1;

    while(device->run())
    if (device->isWindowActive())
    {
            driver->beginScene(true, true, 0 );

            smgr->drawAll();
            env->drawAll();

            driver->endScene();

            // display frames per second in window title
            int fps = driver->getFPS();
            if (lastFPS != fps)
//.........这里部分代码省略.........
开发者ID:glauber-guimaraes,项目名称:irrlichtStuff,代码行数:101,代码来源:Tutorial12.cpp


示例6: push_dir_info

/* Helper func for recursively fetching svn_dirent_t's from a remote
   directory and pushing them at an info-receiver callback.

   DEPTH is the depth starting at DIR, even though RECEIVER is never
   invoked on DIR: if DEPTH is svn_depth_immediates, then invoke
   RECEIVER on all children of DIR, but none of their children; if
   svn_depth_files, then invoke RECEIVER on file children of DIR but
   not on subdirectories; if svn_depth_infinity, recurse fully.
   DIR is a relpath, relative to the root of RA_SESSION.
*/
static svn_error_t *
push_dir_info(svn_ra_session_t *ra_session,
              const char *session_URL,
              const char *dir,
              svn_revnum_t rev,
              const char *repos_UUID,
              const char *repos_root,
              svn_client_info_receiver2_t receiver,
              void *receiver_baton,
              svn_depth_t depth,
              svn_client_ctx_t *ctx,
              apr_hash_t *locks,
              apr_pool_t *pool)
{
  apr_hash_t *tmpdirents;
  apr_hash_index_t *hi;
  apr_pool_t *subpool = svn_pool_create(pool);

  SVN_ERR(svn_ra_get_dir2(ra_session, &tmpdirents, NULL, NULL,
                          dir, rev, DIRENT_FIELDS, pool));

  for (hi = apr_hash_first(pool, tmpdirents); hi; hi = apr_hash_next(hi))
    {
      const char *path, *URL, *fs_path;
      svn_lock_t *lock;
      svn_client_info2_t *info;
      const char *name = svn__apr_hash_index_key(hi);
      svn_dirent_t *the_ent = svn__apr_hash_index_val(hi);

      svn_pool_clear(subpool);

      if (ctx->cancel_func)
        SVN_ERR(ctx->cancel_func(ctx->cancel_baton));

      path = svn_relpath_join(dir, name, subpool);
      URL = svn_path_url_add_component2(session_URL, name, subpool);
      fs_path = svn_fspath__canonicalize(svn_uri__is_child(repos_root, URL,
                                                           subpool), subpool);

      lock = apr_hash_get(locks, fs_path, APR_HASH_KEY_STRING);

      SVN_ERR(build_info_from_dirent(&info, the_ent, lock, URL, rev,
                                     repos_UUID, repos_root, subpool));

      if (depth >= svn_depth_immediates
          || (depth == svn_depth_files && the_ent->kind == svn_node_file))
        {
          SVN_ERR(receiver(receiver_baton, path, info, subpool));
        }

      if (depth == svn_depth_infinity && the_ent->kind == svn_node_dir)
        {
          SVN_ERR(push_dir_info(ra_session, URL, path,
                                rev, repos_UUID, repos_root,
                                receiver, receiver_baton,
                                depth, ctx, locks, subpool));
        }
    }

  svn_pool_destroy(subpool);

  return SVN_NO_ERROR;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:73,代码来源:info.c


示例7: sender_3

void sender_3 ()
{
	receiver (5);
}
开发者ID:VargMon,项目名称:dd-wrt,代码行数:4,代码来源:redecl2.C


示例8: cass_prepared_bind

void CassDriver::Retrieve(
    std::tr1::function<void(bool success, Wrapper* data)> cob,
    const std::string& receiver_id, Wrapper* data_wrapper) {
  CassStatement* statement = cass_prepared_bind(select_prepared_);
  cass_statement_bind_string(statement, 0,
                             cass_string_init(receiver_id.c_str()));
  cass_statement_set_paging_size(statement, FLAGS_page_size);

  CassFuture* future = cass_session_execute(session_, statement);
  auto retrieve_cb = [](CassFuture* future, void* data) {
    CassError rc = cass_future_error_code(future);
    Wrapper* wrapper = (Wrapper*)data;
    if (rc == CASS_OK) {
      const CassResult* result = cass_future_get_result(future);
      if (cass_result_row_count(result)) {
        CassIterator* iterator = cass_iterator_from_result(result);
        CassString cass_receiver, cass_time, cass_msg_id,
                   cass_group_id, cass_msg, cass_sender;
        while (cass_iterator_next(iterator)) {
          const CassRow* row = cass_iterator_get_row(iterator);
          cass_value_get_string(cass_row_get_column(row, 0), &cass_receiver);
          cass_value_get_string(cass_row_get_column(row, 1), &cass_time);
          cass_value_get_string(cass_row_get_column(row, 2), &cass_msg_id);
          cass_value_get_string(cass_row_get_column(row, 3), &cass_group_id);
          cass_value_get_string(cass_row_get_column(row, 4), &cass_msg);
          cass_value_get_string(cass_row_get_column(row, 5), &cass_sender);
            
          std::string receiver(cass_receiver.data, cass_receiver.length);
          std::string time(cass_time.data, cass_time.length);
          std::string msg_id(cass_msg_id.data, cass_msg_id.length);
          std::string group_id(cass_group_id.data, cass_group_id.length);
          std::string msg(cass_msg.data, cass_msg.length);
          std::string sender(cass_sender.data, cass_sender.length);

          boost::shared_ptr<Message> message(new Message());
          message->__set_receiver_id(receiver);
          message->__set_timestamp(time);
          message->__set_msg_id(msg_id);
          message->__set_group_id(group_id);
          message->__set_msg(msg);
          message->__set_sender_id(sender);
          wrapper->pmsgs->push_back(message);
        }
        cass_bool_t has_more_pages = cass_result_has_more_pages(result);
        if (has_more_pages) {
          cass_statement_set_paging_state(wrapper->statement, result);
          (wrapper->func)();
        } else {
          cass_statement_free(wrapper->statement);
          CassStatement* statement =
              cass_prepared_bind(wrapper->this_obj->delete_prepared_);
          cass_statement_bind_string(statement, 0, cass_receiver);
          CassFuture* delete_future =
              cass_session_execute(wrapper->this_obj->session_, statement);
          cass_future_free(delete_future);
          cass_statement_free(statement);

          (wrapper->cob)(true, wrapper);
        }
        cass_iterator_free(iterator);
      } else {
        cass_statement_free(wrapper->statement);
        (wrapper->cob)(true, wrapper);
      }
      cass_result_free(result);
    } else {
      cass_statement_free(wrapper->statement);
      wrapper->this_obj->PrintError(future);
      (wrapper->cob)(false, wrapper);
    }
  };

  data_wrapper->this_obj = this;
  data_wrapper->cob = cob;
  data_wrapper->statement = statement;
  data_wrapper->func = [=]() {
    CassFuture* future = cass_session_execute(session_, statement);
    cass_future_set_callback(future, retrieve_cb, data_wrapper);
    cass_future_free(future);
  };

  cass_future_set_callback(future, retrieve_cb, data_wrapper);
  cass_future_free(future);
}
开发者ID:kongjialin,项目名称:cassandra-with-cpp-driver,代码行数:84,代码来源:cass_driver.cpp


示例9: sender_1

void sender_1 ()
{
	receiver (3,7);
}
开发者ID:VargMon,项目名称:dd-wrt,代码行数:4,代码来源:redecl2.C


示例10: sender_2

void sender_2 ()
{
	receiver (5);
}
开发者ID:VargMon,项目名称:dd-wrt,代码行数:4,代码来源:redecl2.C


示例11: svn_client_blame4

svn_error_t *
svn_client_blame4(const char *target,
                  const svn_opt_revision_t *peg_revision,
                  const svn_opt_revision_t *start,
                  const svn_opt_revision_t *end,
                  const svn_diff_file_options_t *diff_options,
                  svn_boolean_t ignore_mime_type,
                  svn_boolean_t include_merged_revisions,
                  svn_client_blame_receiver2_t receiver,
                  void *receiver_baton,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
{
  struct file_rev_baton frb;
  svn_ra_session_t *ra_session;
  const char *url;
  svn_revnum_t start_revnum, end_revnum;
  struct blame *walk, *walk_merged = NULL;
  apr_file_t *file;
  apr_pool_t *iterpool;
  svn_stream_t *stream;

  if (start->kind == svn_opt_revision_unspecified
      || end->kind == svn_opt_revision_unspecified)
    return svn_error_create
      (SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
  else if (start->kind == svn_opt_revision_working
           || end->kind == svn_opt_revision_working)
    return svn_error_create
      (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
       _("blame of the WORKING revision is not supported"));

  /* Get an RA plugin for this filesystem object. */
  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &end_revnum,
                                           &url, target, NULL,
                                           peg_revision, end,
                                           ctx, pool));

  SVN_ERR(svn_client__get_revision_number(&start_revnum, NULL, ra_session,
                                          start, target, pool));

  if (end_revnum < start_revnum)
    return svn_error_create
      (SVN_ERR_CLIENT_BAD_REVISION, NULL,
       _("Start revision must precede end revision"));

  frb.start_rev = start_revnum;
  frb.end_rev = end_revnum;
  frb.target = target;
  frb.ctx = ctx;
  frb.diff_options = diff_options;
  frb.ignore_mime_type = ignore_mime_type;
  frb.include_merged_revisions = include_merged_revisions;
  frb.last_filename = NULL;
  frb.last_original_filename = NULL;
  frb.chain = apr_palloc(pool, sizeof(*frb.chain));
  frb.chain->blame = NULL;
  frb.chain->avail = NULL;
  frb.chain->pool = pool;
  if (include_merged_revisions)
    {
      frb.merged_chain = apr_palloc(pool, sizeof(*frb.merged_chain));
      frb.merged_chain->blame = NULL;
      frb.merged_chain->avail = NULL;
      frb.merged_chain->pool = pool;
    }

  SVN_ERR(svn_io_temp_dir(&frb.tmp_path, pool));
  frb.tmp_path = svn_path_join(frb.tmp_path, "tmp", pool),

  frb.mainpool = pool;
  /* The callback will flip the following two pools, because it needs
     information from the previous call.  Obviously, it can't rely on
     the lifetime of the pool provided by get_file_revs. */
  frb.lastpool = svn_pool_create(pool);
  frb.currpool = svn_pool_create(pool);
  if (include_merged_revisions)
    {
      frb.filepool = svn_pool_create(pool);
      frb.prevfilepool = svn_pool_create(pool);
    }

  /* Collect all blame information.
     We need to ensure that we get one revision before the start_rev,
     if available so that we can know what was actually changed in the start
     revision. */
  SVN_ERR(svn_ra_get_file_revs2(ra_session, "",
                                start_revnum - (start_revnum > 0 ? 1 : 0),
                                end_revnum, include_merged_revisions,
                                file_rev_handler, &frb, pool));

  /* Report the blame to the caller. */

  /* The callback has to have been called at least once. */
  assert(frb.last_filename != NULL);

  /* Create a pool for the iteration below. */
  iterpool = svn_pool_create(pool);

  /* Open the last file and get a stream. */
//.........这里部分代码省略.........
开发者ID:vocho,项目名称:openqnx,代码行数:101,代码来源:blame.c


示例12: main

int main(int argc, char *argv[])
{
	int port;
	char *host;
	char * filename = NULL;

	int opt;
	int option_index = 0;
	struct option long_options[] = {
		{"filename",	required_argument,	0, 'f'},
		{0,				0,					0,  0 }
	};

	/* Check if -f/--filename option is present */
	while ((opt = getopt_long(argc, argv, "f:", long_options, &option_index)) != -1) {
		switch (opt) {
			case 'f':
			filename = optarg;
			break;
			default:
			fprintf(stderr, "Try './receiver' for more information.\n");
			return EXIT_FAILURE;
			break;
		}
	}

	/* Get hostname and port */
	if((argc - optind) != 2) {
		fprintf(stderr, "Usage:\n"
		"\treceiver [OPTION] HOSTNAME PORT\n"
		"Option:\n"
		"-f, --filename FILENAME\n"
		"\tsaves the data received into FILENAME\n");
		return EXIT_FAILURE;
	}

	host = argv[optind++];
	port = atoi(argv[optind++]);

	/* Resolve the hostname */
	struct sockaddr_in6 addr;
	const char *err = real_address(host, &addr);
	if (err) {
		fprintf(stderr, "Could not resolve hostname %s: %s\n", host, err);
		return EXIT_FAILURE;
	}

	/* Get a socket */
	int sfd = create_socket(&addr, port, NULL, -1); /* Bound */
	if (sfd > 0 && wait_for_sender(sfd) < 0) { /* Connected */
		fprintf(stderr,"Could not connect the socket after the first packet.\n");
		close(sfd);
		return EXIT_FAILURE;
	}

	if (sfd < 0) {
		fprintf(stderr, "Failed to create the socket!\n");
		return EXIT_FAILURE;
	}

	/* Process I/O */
	receiver(sfd, filename);

	close(sfd);

	return EXIT_SUCCESS;
}
开发者ID:anpar,项目名称:lingi1141-projet,代码行数:67,代码来源:receiver.c


示例13: main

int main( int argc, char* argv[] )
{
    QApplication app(argc, argv);
    LOGGER.setLevel( 3 );
    LOGGER.setOutput( Logger::Console );
    LOG( 1, "Pixout ArtNet Viewer" );
    LOG( 1, "viewer Version: %s ", VERSION );

    const QString settings_path = QDir::fromNativeSeparators(
                QStandardPaths::writableLocation( QStandardPaths::AppLocalDataLocation ) + QDir::separator()
                );

    // create settings location if not exists
    QDir ().mkdir( settings_path );
    AppSettings settings;

    if( argc < 3 )
    {
        if( !settings.load( settings_path + "app.data") )
        {
           WARN("Can't open or empty fixture file: %s", qPrintable(settings_path + "app.data") );
        }
    }
    else {
        settings.setProperty("port", atoi( argv[1] ));
        settings.setProperty("fixturePath", argv[2]);
        settings.setProperty("position", argv[3]);
    }

    QQmlApplicationEngine engine;
    app.setWindowIcon(QIcon(":favicon.png"));
    engine.addImportPath( QStringLiteral("qrc:/"));

    qmlRegisterType<PainterOutput>("Painter", 1, 0, "PainterItem");
    qmlRegisterUncreatableType<AppSettings,1>("AppSettings",1,0,"AppSettings","AppSettings couldn't be created from QML");

    engine.rootContext()->setContextProperty("settings", &settings);
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    QObject *rootObject = engine.rootObjects().first();
    Q_ASSERT( rootObject );

    PainterOutput *output( rootObject->findChild<PainterOutput*>( "painter" ) );
    Q_ASSERT( output );

    Painter painter( output, &settings );
    PixelMapperWithError mapper( &settings );
    painter.SetPixelMapper( &mapper );
    Receiver receiver( &settings );

    QObject::connect( &receiver, &Receiver::Received, &painter, &Painter::Draw );
    QObject::connect( &painter, &Painter::ReadyToOutput, output, &PainterOutput::Process );

    QObject::connect( &mapper, &PixelMapper::OnResize, &painter, &Painter::Resize );
    QObject::connect( &mapper, &PixelMapper::OnResize, output, &PainterOutput::setCellSize );

    QObject::connect( &settings, &AppSettings::fixturePathChanged, &mapper, &PixelMapperWithError::Reload );
    QObject::connect( &settings, &AppSettings::portChanged, &receiver, &Receiver::Reconnect );
    QObject::connect( &settings, &AppSettings::positionChanged, &painter, &Painter::RePosition );

    if( !settings.fixturePath().isEmpty() )
        mapper.Reload();
    else
        WARN("Pixel mapping empty, skip" );

    LOG(1, "Listening on port %u with pixel-mapping file %s and orientation %s",
       settings.port(), qPrintable(settings.fixturePath()), painter.Orientation() == Painter::Vertical ? "vertical" : "horizontal" );

    QQuickWindow *window = qobject_cast<QQuickWindow *>(rootObject);
    Q_ASSERT( window );
    window->show();

    const int res = app.exec();
    settings.Save( settings_path + "app.data" );
    return res;
}
开发者ID:pixout,项目名称:PixView,代码行数:76,代码来源:main.cpp


示例14: randomizeBuyers

void MainScreen::doSend()
{
	QList<int> order = randomizeBuyers();
	//QList<Participant> receivers(m_participants.size());

	typedef QPair<Participant, Participant> ParticipantPair;
	QList<ParticipantPair> pairs;

	bool success = false;
	while(!success)
	{
	  bool errorOccurred = false;
	  for(int i = 0; !errorOccurred && i < m_participants.size(); ++i)
	  {
	          // refactor the drafting out into it's own class.  The Input reader
	          // should not know about how drafting occurs
		  	  int j = order[i];

	          Participant buyer(m_participants.value(j)["name"].value<QString>(), m_participants.value(j)["email"].value<QString>(), m_participants.value(j)["exl"].value<QStringList>());
	          Participant receiver(m_participants.value(i)["name"].value<QString>(), m_participants.value(i)["email"].value<QString>(), m_participants.value(i)["exl"].value<QStringList>());
	          if(!IsValidPair(buyer, receiver))
	          {
	            errorOccurred = true;
	          }
	          else
	          {
	        	  pairs.append(ParticipantPair(buyer,receiver));
	          }
	  }

	  if(errorOccurred)
	  {

		  order = randomizeBuyers();
			pairs.clear();
	  }
	  else
	  {
		success = true;
	  }
	}

	AccountService* as = new AccountService();
	Account account = as->defaultAccount(Service::Messages);

	MessageService ms;
	m_subject = m_mainPage->findChild<TextField*>("emailSubject")->text();
	QString body = "<p>" + m_mainPage->findChild<TextArea*>("emailBody")->text() + "</p>";

	for(int i = 0; i < pairs.size(); ++i)
	{
	  QString greeting = "<p>Hi " + pairs[i].first.getName() + "!</p>";
	  QString youGot = "You Received: " + pairs[i].second.getName();
		MessageBuilder* builder = MessageBuilder::create(account.id());
		MessageContact rto = MessageContact(-1,MessageContact::To,pairs[i].first.getName(), pairs[i].first.getEmail());
		QString fullMsg = greeting + body + youGot;
		QByteArray bodyData = fullMsg.toAscii();
		builder->subject(m_subject);
		bool added;
		builder->addRecipient(rto,&added);
		builder->body(MessageBody::Html,bodyData);
		Message message = *builder;

/*
	    connect(&m_messageService, SIGNAL( messageUpdated(bb::pim::account::AccountKey, bb::pim::message::ConversationKey, bb::pim::message::MessageKey, bb::pim::message::MessageUpdate) ),
	            &m_ml,
	            SLOT( messageUpdate(bb::pim::account::AccountKey, bb::pim::message::ConversationKey, bb::pim::message::MessageKey, bb::pim::message::MessageUpdate) ) );
*/


		/*MessageKey mk = */ms.send(account.id(), message);
		/*Message sentMessage = ms.message(account.id(), mk);
		m_ml.setAk(account.id());
		m_ml.setMk(sentMessage.id());
		m_ml.setCk(sentMessage.conversationId());
		m_ml.setMsg(sentMessage);*/
		//********************************************************
	    // Set created root object as the application scene
	    //m_navPane->setBackButtonsVisible(false);
	}

	m_worker->exit();

}
开发者ID:eghantous82,项目名称:OOH,代码行数:84,代码来源:MainScreen.cpp


示例15: getBBoxForMap

MC2BoundingBox getBBoxForMap( uint32 mapID, uint32 listenPort ) {
   DatagramReceiver 
      receiver( MultiCastProperties::changeMapSetPort( listenPort ),
                DatagramReceiver::FINDFREEPORT );
   uint32 mapip = MultiCastProperties::getNumericIP( MODULE_TYPE_MAP, true );
   uint16 mapport = MultiCastProperties::getPort( MODULE_TYPE_MAP, true );
   uint32 mapSet = Properties::getMapSet();
   
   if ( mapSet != MAX_UINT32 ) {
      // code also exists in PacketContainer.cpp and
      // ModuleMap.cpp, move to utility function?
      IPnPort before( mapip, mapport );
      IPnPort newaddr = MultiCastProperties::
         changeMapSetAddr( IPnPort( mapip, mapport ) );

      mapip = newaddr.getIP();
      mapport = newaddr.getPort();
      mc2dbg << "[getBBoxForMap] Changed map module addr from "
             << before << " -> " << newaddr
             << " because mapSet = " << mapSet;
   }

   Packet _pack( MAX_PACKET_SIZE ); // For receiving the mapreply
   DatagramSender sock;


   const int waittime = 1000000;
   uint32 status = StringTable::NOT;
   const int maxRetries = 5;
   int nbrRetries = 0;
   while ( status != StringTable::OK && nbrRetries++ <= maxRetries ) {      
      AllMapRequestPacket reqpack( Packet::RequestID( 1 ),
                                   Packet::PacketID( 1 ),
                                   AllMapRequestPacket::BOUNDINGBOX );
      
      reqpack.setOriginIP( NetUtility::getLocalIP() );
      reqpack.setOriginPort( receiver.getPort() );
      reqpack.setResendNbr((byte) nbrRetries-1);
      
      // Send request to open TCP connection between local and mapmodule
      
      if ( ! sock.send( &reqpack, mapip, mapport ) ) {
         mc2log << error << "[getBBoxForMap] could not send "
                << " AllMapRequestPacket - retrying." << endl;
         continue; // Go another round in the loop.
      }
      
      // Receive packet with ip and port to a mapModule
      if ( ! receiver.receive( &_pack, waittime ) ) {
         mc2log << error << "[getBBoxForMap] error receiving ack - retrying."
                << endl;
         continue; // Go another round in the loop.
      }
      
      if ( _pack.getSubType() != Packet::PACKETTYPE_ALLMAPREPLY ) {
         mc2log << error << "[getBBoxForMap] Got packet with subtype "
                << _pack.getSubTypeAsString()
                << " when expecting allmapreply." << endl;
         continue; // Please try again.
      }
      
      AllMapReplyPacket* pack = static_cast<AllMapReplyPacket *>( &_pack );
      
      status = pack->getStatusCode();
      

      uint32 myMap = 0;
      while ( myMap < pack->getNbrMaps() &&
              mapID != pack->getMapID( myMap ) ){
         ++myMap;
      }

      if ( myMap != pack->getNbrMaps() ) {

         mc2dbg << "[getBBoxForMap] map "
                << prettyMapID(mapID) << " index " << myMap
                << " found " << prettyMapID( pack->getMapID( myMap ) ) << endl;
         MC2BoundingBox bbox;
         pack->setMC2BoundingBox( myMap, &bbox );

         return bbox;

      } else {
         mc2log << warn << "[getBBoxForMap] Map " << prettyMapID( mapID ) 
                << " not found in AllMapReplyPacket." << endl;
      }
   }

   return MC2BoundingBox();
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:90,代码来源:MapModuleCom.cpp


示例16: return

bool SessionChildItem::hasUser(const QString& user) const
{
    return (!session()->nickName().compare(user, Qt::CaseInsensitive)) ||
           (!isChannel() && !receiver().compare(user, Qt::CaseInsensitive)) ||
           (isChannel() && m_usermodel->hasUser(user));
}
开发者ID:MeliodasX,项目名称:communi,代码行数:6,代码来源:sessionchilditem.cpp


示例17: svn_client_blame5

svn_error_t *
svn_client_blame5(const char *target,
                  const svn_opt_revision_t *peg_revision,
                  const svn_opt_revision_t *start,
                  const svn_opt_revision_t *end,
                  const svn_diff_file_options_t *diff_options,
                  svn_boolean_t ignore_mime_type,
                  svn_boolean_t include_merged_revisions,
                  svn_client_blame_receiver3_t receiver,
                  void *receiver_baton,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
{
  struct file_rev_baton frb;
  svn_ra_session_t *ra_session;
  svn_revnum_t start_revnum, end_revnum;
  struct blame *walk, *walk_merged = NULL;
  apr_pool_t *iterpool;
  svn_stream_t *last_stream;
  svn_stream_t *stream;
  const char *target_abspath_or_url;

  if (start->kind == svn_opt_revision_unspecified
      || end->kind == svn_opt_revision_unspecified)
    return svn_error_create
      (SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);

  if (svn_path_is_url(target))
    target_abspath_or_url = target;
  else
    SVN_ERR(svn_dirent_get_absolute(&target_abspath_or_url, target, pool));

  /* Get an RA plugin for this filesystem object. */
  SVN_ERR(svn_client__ra_session_from_path(&ra_session, &end_revnum, NULL,
                                           target, NULL, peg_revision, end,
                                           ctx, pool));

  SVN_ERR(svn_client__get_revision_number(&start_revnum, NULL, ctx->wc_ctx,
                                          target_abspath_or_url, ra_session,
                                          start, pool));

  if (end_revnum < start_revnum)
    return svn_error_create
      (SVN_ERR_CLIENT_BAD_REVISION, NULL,
       _("Start revision must precede end revision"));

  frb.start_rev = start_revnum;
  frb.end_rev = end_revnum;
  frb.target = target;
  frb.ctx = ctx;
  frb.diff_options = diff_options;
  frb.ignore_mime_type = ignore_mime_type;
  frb.include_merged_revisions = include_merged_revisions;
  frb.last_filename = NULL;
  frb.last_original_filename = NULL;
  frb.chain = apr_palloc(pool, sizeof(*frb.chain));
  frb.chain->blame = NULL;
  frb.chain->avail = NULL;
  frb.chain->pool = pool;
  if (include_merged_revisions)
    {
      frb.merged_chain = apr_palloc(pool, sizeof(*frb.merged_chain));
      frb.merged_chain->blame = NULL;
      frb.merged_chain->avail = NULL;
      frb.merged_chain->pool = pool;
    }

  SVN_ERR(svn_ra_get_repos_root2(ra_session, &frb.repos_root_url, pool));

  frb.mainpool = pool;
  /* The callback will flip the following two pools, because it needs
     information from the previous call.  Obviously, it can't rely on
     the lifetime of the pool provided by get_file_revs. */
  frb.lastpool = svn_pool_create(pool);
  frb.currpool = svn_pool_create(pool);
  if (include_merged_revisions)
    {
      frb.filepool = svn_pool_create(pool);
      frb.prevfilepool = svn_pool_create(pool);
    }

  /* Collect all blame information.
     We need to ensure that we get one revision before the start_rev,
     if available so that we can know what was actually changed in the start
     revision. */
  SVN_ERR(svn_ra_get_file_revs2(ra_session, "",
                                start_revnum - (start_revnum > 0 ? 1 : 0),
                                end_revnum, include_merged_revisions,
                                file_rev_handler, &frb, pool));

  if (end->kind == svn_opt_revision_working)
    {
      /* If the local file is modified we have to call the handler on the
         working copy file with keywords unexpanded */
      svn_wc_status3_t *status;

      SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, target_abspath_or_url, pool,
                             pool));

      if (status->text_status != svn_wc_status_normal)
//.........这里部分代码省略.........
开发者ID:dtrebbien,项目名称:subversion,代码行数:101,代码来源:blame.c


示例18: main

int main() {
    int val;
    int rc;

    /* Receiver waits for sender. */
    int ch1[2];
    rc = chmake(ch1);
    errno_assert(rc == 0);
    assert(ch1[0] >= 0);
    assert(ch1[1] >= 0);
    int hndl1 = go(sender(ch1[0], 1, 333));
    errno_assert(hndl1 >= 0);
    rc = chrecv(ch1[1], &val, sizeof(val), -1);
    errno_assert(rc == 0);
    assert(val == 333);
    rc = hclose(ch1[1]);
    err 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ receivers函数代码示例发布时间:2022-05-30
下一篇:
C++ receive_message函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap