Exemplo n.º 1
0
void drawTable(const vector<vector<string>>& table, vector<int>& columnWide){
	vector<string> row;
	/*for (int i = 0; i < columnWide.size(); i++){
	cout << columnWide[i] << endl;
	}*/
	string a;
	for (int j = 0; j < columnWide.size(); j++){
		a += "+-" + put_(columnWide[j]) + "-";
	}
	a += "+";

	string t;
	int n = table[0].size();
	int m = table.size();
	row.push_back(a);
	for (int i = 0; i < n; i++){//行
		t = "";
		if (i == 1)
			row.push_back(a);
		for (int j = 0; j < m; j++){//列
			t += "| " + table[j][i] + putbx(columnWide[j] - table[j][i].size()) + " ";
		}
		t += "|";
		row.push_back(t);
	}
	row.push_back(a);

	for (int i = 0; i < row.size(); i++){
		cout << row[i] << endl;
	}
}
Exemplo n.º 2
0
    void put(zvalue val)
    {
        if (occupied++ >= size/2)
        resize(2*size);
        else if (occupied_and_deleted >= size-1)
        resize(size);

        put_(val);
    }
Exemplo n.º 3
0
 int TairHelper::insert_del_family_log_(const int64_t family_id, const uint64_t own_ipport)
 {
   char pkey[128] = {'\0'};
   char skey[128] = {'\0'};
   char value[1024] = {'\0'};
   snprintf(pkey, 128, "%s%06d_del_%"PRI64_PREFIX"u", key_prefix_.c_str(), DELETE_FAMILY_CHUNK_DEFAULT_VALUE, own_ipport);
   snprintf(skey, 128, "%020"PRI64_PREFIX"d", family_id);
   FamilyInfo family_info;
   family_info.family_id_ = family_id;
   int64_t pos = 0;
   int32_t ret = TFS_SUCCESS != family_info.serialize(value, 1024, pos) ? EXIT_SERIALIZE_ERROR : TFS_SUCCESS;
   ret = put_(pkey, skey, value, family_info.length());
   if (TAIR_RETURN_SUCCESS != ret)
   {
     TBSYS_LOG(WARN, "del family log : %"PRI64_PREFIX"d error: call tair put error, ret: %d, pkey: %s, skey: %s", family_info.family_id_, ret, pkey, skey);
     ret = EXIT_OP_TAIR_ERROR;
   }
   return ret;
 }
Exemplo n.º 4
0
    void resize(int a_new_size)
    {
        zvalue* old_block = block;
        int old_size = size;

        block = new zvalue [size = a_new_size];
        memset(block, 0, size*sizeof(zvalue));

        if (NULL!=old_block) {
            int ix;
            for (ix = 0; ix < old_size; ++ix) {
          if (!NULLP(old_block[ix]) && !DELETEDP(old_block[ix]))
                    put_(old_block[ix]);
            }

        occupied_and_deleted = occupied;

            delete [] old_block;
        }
    }
Exemplo n.º 5
0
 int TairHelper::create_family(FamilyInfo& family_info)
 {
   int64_t pos = 0;
   char pkey[64] = {'\0'};
   char skey[128] = {'\0'};
   char value[1024] = {'\0'};
   snprintf(pkey, 64, "%s%06d", key_prefix_.c_str(), get_bucket(family_info.family_id_));
   snprintf(skey, 64, "%020"PRI64_PREFIX"d", family_info.family_id_);
   int32_t ret = TFS_SUCCESS != family_info.serialize(value, 1024, pos) ? EXIT_SERIALIZE_ERROR : TFS_SUCCESS;
   if (TFS_SUCCESS == ret)
   {
     tbutil::Mutex::Lock lock(mutex_);
     ret = put_(pkey, skey, value, family_info.length());
     if (TAIR_RETURN_SUCCESS != ret)
     {
       TBSYS_LOG(WARN, "create family : %"PRI64_PREFIX"d error: call tair put error, ret: %d, pkey: %s, skey: %s", family_info.family_id_, ret, pkey, skey);
     }
     ret = (TAIR_RETURN_SUCCESS == ret) ? TFS_SUCCESS : EXIT_OP_TAIR_ERROR;
   }
   return ret;
 }
Exemplo n.º 6
0
	void put( value_type const& va)
	{
		unique_lock< shared_mutex > lk( mtx_);
		put_( va);
	}
Exemplo n.º 7
0
 annotation_key& operator=(const char *x) { put_(symbol(x)); return *this; }
Exemplo n.º 8
0
 /// @name Extra conversions for strings, treated as codec::SYMBOL.
 /// @{
 annotation_key& operator=(const std::string& x) { put_(symbol(x)); return *this; }
Exemplo n.º 9
0
 annotation_key& operator=(const symbol& x) { put_(x); return *this; }
Exemplo n.º 10
0
 /// @name Assign from a uint64_t or symbol.
 /// @{
 annotation_key& operator=(uint64_t x) { put_(x); return *this; }