Пример #1
0
void
TAO_Notify_Admin::save_persistent (TAO_Notify::Topology_Saver& saver)
{
  bool changed = this->children_changed_;
  this->children_changed_ = false;
  this->self_changed_ = false;

  if (is_persistent ())
    {
      TAO_Notify::NVPList attrs;
      this->save_attrs(attrs);

      const char* type = this->get_admin_type_name();

      bool want_all_children =
        saver.begin_object(this->id(), type, attrs, changed);

      if (want_all_children || this->filter_admin_.is_changed ())
        {
          this->filter_admin_.save_persistent(saver);
        }
      if (want_all_children || this->subscribed_types_.is_changed ())
        {
          this->subscribed_types_.save_persistent(saver);
        }

      TAO_Notify::Save_Persist_Worker<TAO_Notify_Proxy>
        wrk(saver, want_all_children);
      this->proxy_container().collection()->for_each(&wrk);

      saver.end_object(this->id(), type);
    }
}
Пример #2
0
/*
 * fill the pageframe corresponding to the struct page with the data
 * from the passed pampd
 */
static int zcache_pampd_get_data(char *data, size_t *sizep, bool raw,
					void *pampd, struct tmem_pool *pool,
					struct tmem_oid *oid, uint32_t index)
{
	int ret;
	bool eph = !is_persistent(pool);

	BUG_ON(preemptible());
	BUG_ON(eph);	/* fix later if shared pools get implemented */
	BUG_ON(pampd_is_remote(pampd));

	if (pampd == (void *)ZERO_FILLED) {
		handle_zero_filled_page(data);
		if (!raw)
			*sizep = PAGE_SIZE;
		return 0;
	}

	if (raw)
		ret = zbud_copy_from_zbud(data, (struct zbudref *)pampd,
						sizep, eph);
	else {
		ret = zbud_decompress((struct page *)(data),
					(struct zbudref *)pampd, false,
					zcache_decompress);
		*sizep = PAGE_SIZE;
	}
	return ret;
}
Пример #3
0
void
TAO_Notify_Proxy::save_persistent (TAO_Notify::Topology_Saver& saver)
{
  bool changed = this->children_changed_;
  this->children_changed_ = false;
  this->self_changed_ = false;

  if (is_persistent ())
  {
    TAO_Notify::NVPList attrs;
    this->save_attrs(attrs);

    const char * type_name = this->get_proxy_type_name ();
    bool want_all_children = saver.begin_object(this->id(), type_name, attrs, changed);

    if (want_all_children || this->filter_admin_.is_changed ())
    {
      this->filter_admin_.save_persistent(saver);
    }

    if (want_all_children || this->subscribed_types_.is_changed ())
    {
      this->subscribed_types_.save_persistent(saver);
    }

    // todo: handle removed children

    saver.end_object(this->id(), type_name);
  }
}
Пример #4
0
void
TAO_Notify_EventChannel::save_persistent (TAO_Notify::Topology_Saver& saver)
{
  bool changed = this->self_changed_;
  this->self_changed_ = false;
  this->children_changed_ = false;

  if (is_persistent ())
  {
    TAO_Notify::NVPList attrs;
    this->save_attrs(attrs);

    bool want_all_children = saver.begin_object(
      this->id(), "channel", attrs, changed);

    this->default_filter_factory_servant_->save_persistent (saver);

    TAO_Notify::Save_Persist_Worker<TAO_Notify_ConsumerAdmin> ca_wrk(saver, want_all_children);

    this->ca_container().collection()->for_each(&ca_wrk);

    TAO_Notify::Save_Persist_Worker<TAO_Notify_SupplierAdmin> sa_wrk(saver, want_all_children);
    this->sa_container().collection()->for_each(&sa_wrk);

    saver.end_object(this->id(), "channel");
  }
}
Пример #5
0
 bool
 Topology_Object::send_deletion_change (void)
 {
   bool saving = false;
   if (is_persistent ())
   {
     saving = this->change_to_parent ();
   }
   this->self_changed_ = false;
   this->children_changed_ = false;
   return saving;
 }
Пример #6
0
/*
 * fill the pageframe corresponding to the struct page with the data
 * from the passed pampd
 */
static int zcache_pampd_get_data_and_free(char *data, size_t *sizep, bool raw,
					void *pampd, struct tmem_pool *pool,
					struct tmem_oid *oid, uint32_t index)
{
	int ret = 0;
	bool eph = !is_persistent(pool), zero_filled = false;
	struct page *page = NULL;
	unsigned int zsize, zpages;

	BUG_ON(preemptible());
	BUG_ON(pampd_is_remote(pampd));

	if (pampd == (void *)ZERO_FILLED) {
		handle_zero_filled_page(data);
		zero_filled = true;
		zsize = 0;
		zpages = 1;
		if (!raw)
			*sizep = PAGE_SIZE;
		dec_zcache_zero_filled_pages();
		goto zero_fill;
	}

	if (raw)
		ret = zbud_copy_from_zbud(data, (struct zbudref *)pampd,
						sizep, eph);
	else {
		ret = zbud_decompress((struct page *)(data),
					(struct zbudref *)pampd, eph,
					zcache_decompress);
		*sizep = PAGE_SIZE;
	}
	page = zbud_free_and_delist((struct zbudref *)pampd, eph,
					&zsize, &zpages);
zero_fill:
	if (eph) {
		if (page)
			dec_zcache_eph_pageframes();
		dec_zcache_eph_zpages(zpages);
		dec_zcache_eph_zbytes(zsize);
	} else {
		if (page)
			dec_zcache_pers_pageframes();
		dec_zcache_pers_zpages(zpages);
		dec_zcache_pers_zbytes(zsize);
	}
	if (!is_local_client(pool->client) && !zero_filled)
		ramster_count_foreign_pages(eph, -1);
	if (page && !zero_filled)
		zcache_free_page(page);
	return ret;
}
Пример #7
0
static void test_noerror(CuTest *tc) {
    unit *u;
    struct locale *lang;
    message *msg;

    test_setup();
    lang = test_create_locale();
    u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
    u->thisorder = parse_order("!@move", lang);
    CuAssertIntEquals(tc, K_MOVE | CMD_QUIET | CMD_PERSIST,  u->thisorder->command);
    CuAssertTrue(tc, !is_persistent(u->thisorder));
    CuAssertPtrEquals(tc, NULL, msg = msg_error(u, u->thisorder, 100));
    assert(!msg);
    CuAssertPtrEquals(tc, NULL, msg = msg_feedback(u, u->thisorder, "error_unit_not_found", NULL));
    assert(!msg);
    test_teardown();
}
Пример #8
0
 bool
 Topology_Object::send_change (void)
 {
   bool saving = false;
   if (is_persistent ())
   {
     while (this->self_changed_ || this->children_changed_)
     {
       saving = this->change_to_parent ();
       if (!saving)
       {
         this->self_changed_ = false;
         this->children_changed_ = false;
       }
     }
   }
   else
   {
     this->self_changed_ = false;
     this->children_changed_ = false;
   }
   return saving;
 }
Пример #9
0
int print_properties_num(longnum num)
{
	printf("%llu:\nprime factors: ", num);
	print_prime_factors(num);
	printf("\n");

	if ( is_abundant(num) ) printf(" abundant");
	if ( is_amicable(num) ) printf(" amicable");
	if ( is_apocalyptic_power(num) ) printf(" apocalyptic_power");
	if ( is_aspiring(num) ) printf(" aspiring");
	if ( is_automorphic(num) ) printf(" automorphic");
	if ( is_cake(num) ) printf(" cake");
	if ( is_carmichael(num) ) printf(" carmichael");
	if ( is_catalan(num) ) printf(" catalan");
	if ( is_composite(num) ) printf(" composite");
	if ( is_compositorial(num) ) printf(" compositorial");
	if ( is_cube(num) ) printf(" cube");
	if ( is_deficient(num) ) printf(" deficient");
	if ( is_easy_to_remember(num) ) printf(" easy_to_remember");
	if ( is_ecci1(num) ) printf(" ecci1");
	if ( is_ecci2(num) ) printf(" ecci2");
	if ( is_even(num) ) printf(" even");
	if ( is_evil(num) ) printf(" evil");
	if ( is_factorial(num) ) printf(" factorial");
	if ( is_fermat(num) ) printf(" fermat");
	if ( is_fibonacci(num) ) printf(" fibonacci");
	if ( is_google(num) ) printf(" google");
	if ( is_happy(num) ) printf(" happy");
	if ( is_hungry(num) ) printf(" hungry");
	if ( is_hypotenuse(num) ) printf(" hypotenuse");
	if ( is_lazy_caterer(num) ) printf(" lazy_caterer");
	if ( is_lucky(num) ) printf(" lucky");
	if ( is_mersenne_prime(num) ) printf(" mersenne_prime");
	if ( is_mersenne(num) ) printf(" mersenne");
	if ( is_narcissistic(num) ) printf(" narcissistic");
	if ( is_odd(num) ) printf(" odd");
	if ( is_odious(num) ) printf(" odious");
	if ( is_palindrome(num) ) printf(" palindrome");
	if ( is_palindromic_prime(num) ) printf(" palindromic_prime");
	if ( is_parasite(num) ) printf(" parasite");
	if ( is_pentagonal(num) ) printf(" pentagonal");
	if ( is_perfect(num) ) printf(" perfect");
	if ( is_persistent(num) ) printf(" persistent");
	if ( is_power_of_2(num) ) printf(" power_of_2");
	if ( is_powerful(num) ) printf(" powerful");
	if ( is_practical(num) ) printf(" practical");
	if ( is_prime(num) ) printf(" prime");
	if ( is_primorial(num) ) printf(" primorial");
	if ( is_product_perfect(num) ) printf(" product_perfect");
	if ( is_pronic(num) ) printf(" pronic");
	if ( is_repdigit(num) ) printf(" repdigit");
	if ( is_repunit(num) ) printf(" repunit");
	if ( is_smith(num) ) printf(" smith");
	if ( is_sociable(num) ) printf(" sociable");
	if ( is_square_free(num) ) printf(" square_free");
	if ( is_square(num) ) printf(" square");
	if ( is_tetrahedral(num) ) printf(" tetrahedral");
	if ( is_triangular(num) ) printf(" triangular");
	if ( is_twin(num) ) printf(" twin");
	if ( is_ulam(num) ) printf(" ulam");
	if ( is_undulating(num) ) printf(" undulating");
	if ( is_untouchable(num) ) printf(" untouchable");
	if ( is_vampire(num) ) printf(" vampire");
	if ( is_weird(num) ) printf(" weird");

	printf("\n\n");
	return 0;
}