本文整理汇总了C++中collect函数的典型用法代码示例。如果您正苦于以下问题:C++ collect函数的具体用法?C++ collect怎么用?C++ collect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了collect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: log
void
MB12XX::cycle()
{
/* collection phase? */
if (_collect_phase) {
/* perform collection */
if (OK != collect()) {
log("collection error");
/* restart the measurement state machine */
start();
return;
}
/* next phase is measurement */
_collect_phase = false;
/*
* Is there a collect->measure gap?
*/
if (_measure_ticks > USEC2TICK(MB12XX_CONVERSION_INTERVAL)) {
/* schedule a fresh cycle call when we are ready to measure again */
work_queue(HPWORK,
&_work,
(worker_t)&MB12XX::cycle_trampoline,
this,
_measure_ticks - USEC2TICK(MB12XX_CONVERSION_INTERVAL));
return;
}
}
/* measurement phase */
if (OK != measure())
log("measure error");
/* next phase is collection */
_collect_phase = true;
/* schedule a fresh cycle call when the measurement is done */
work_queue(HPWORK,
&_work,
(worker_t)&MB12XX::cycle_trampoline,
this,
USEC2TICK(MB12XX_CONVERSION_INTERVAL));
}
开发者ID:avnishks,项目名称:px4,代码行数:47,代码来源:mb12xx.cpp
示例2: get_ifconfig_info
static int
get_ifconfig_info(struct net_desc *devs)
{
char *buf_in;
char *buf_tmp;
const char **ignore;
char *buf;
char *tmp;
int textsize;
int i;
/* Get ifconfig information */
textsize = collect(T_OUTPUT, &buf_in, "/sbin/ifconfig -l 2>/dev/null");
if (textsize < 0) {
if (logfp)
(void)fprintf(logfp,
"Aborting: Could not run ifconfig.\n");
(void)fprintf(stderr, "Could not run ifconfig.");
exit(1);
}
buf = malloc (STRSIZE * sizeof(char));
for (i = 0, buf_tmp = buf_in; strlen(buf_tmp) > 0 && buf_tmp < buf_in +
strlen(buf_in);) {
tmp = stpncpy(buf, buf_tmp, strcspn(buf_tmp," \n"));
*tmp='\0';
buf_tmp += (strcspn(buf_tmp, " \n") + 1) * sizeof(char);
/* Skip ignored interfaces */
for (ignore = ignored_if_names; *ignore != NULL; ignore++) {
size_t len = strlen(*ignore);
if (strncmp(buf, *ignore, len) == 0 &&
isdigit((unsigned char)buf[len]))
break;
}
if (*ignore != NULL)
continue;
strlcpy (devs[i].if_dev, buf, STRSIZE);
i++;
}
strcpy(devs[i].if_dev, "\0");
free(buf);
free(buf_in);
return i;
}
开发者ID:ycui1984,项目名称:netbsd-src,代码行数:47,代码来源:net.c
示例3: load
void ResourceConverter::convert()
{
for (auto file : listResources(m_resourceRoot
, textureDir
, textureExtension)) {
load(textureDir, file, textureExtension);
}
for (auto file : listResources(m_resourceRoot
, mmlDir
, mmlExtension)) {
load(mmlDir, file, mmlExtension);
}
collect();
compress();
encrypt();
write();
}
开发者ID:hop-,项目名称:Mercurius,代码行数:17,代码来源:resource_converter.cpp
示例4: collect_generations
static long
collect_generations(void)
{
int i;
long n = 0;
/* Find the oldest generation (higest numbered) where the count
* exceeds the threshold. Objects in the that generation and
* generations younger than it will be collected. */
for (i = NUM_GENERATIONS-1; i >= 0; i--) {
if (generations[i].count > generations[i].threshold) {
n = collect(i);
break;
}
}
return n;
}
开发者ID:JupiterSmalltalk,项目名称:openqwaq,代码行数:17,代码来源:gcmodule.c
示例5: collect
static void collect(int *psize)
{
move_t m;
uint32 hm;
if(*psize >= MAXPLY) return;
hm = tt_get_hashmove(pos->hash);
if(hm)
{ m.p = hm;
if(make_if_legal(m))
{ pv_backup[*psize].p = hm;
*psize += 1;
collect(psize);
move_unmake();
}
}
}
开发者ID:JERUKA9,项目名称:lucaschess,代码行数:17,代码来源:io.c
示例6: collect
void collect(vector<vector<int>> mark, vector<string>& res, string s, int start, string tmp){
for(auto stop : mark[start]){
string sstr = s.substr(start, stop - start);
string newtmp = start == 0 ? sstr : tmp + " "+ sstr;
if(stop == s.length())
res.push_back(newtmp);
else collect(mark, res, s, stop, newtmp);
}
}
开发者ID:youyesun,项目名称:algorithm,代码行数:17,代码来源:word_break_ii.cpp
示例7: filtered_keys
Array* LookupTable::filtered_keys(STATE, ObjectMatcher& matcher) {
class filtered_keys : public CollectAction {
ObjectMatcher& m_;
public:
filtered_keys(ObjectMatcher& m)
: m_(m)
{}
virtual Object* call(STATE, LookupTableBucket* bucket) {
if(m_.match_p(state, bucket->key())) return bucket->key();
return 0;
}
} match(matcher);
return collect(state, this, match);
}
开发者ID:atoulme,项目名称:rubinius,代码行数:17,代码来源:lookuptable.cpp
示例8: collect_refs
void ReachingDefinitionBase::
collect_refs ( AstInterface& fa, const AstNodePtr& h, FunctionSideEffectInterface* a,
AstInterface::AstNodeList* in)
{
for (AstInterface::AstNodeList::iterator p = in->begin();
p != in->end(); ++p) {
AstNodePtr cur = *p;
std::string varname;
AstNodePtr scope;
if (fa.IsVarRef( cur, 0, &varname, &scope))
add_ref(varname, scope, std::pair<AstNodePtr, AstNodePtr>(cur, AST_NULL) );
}
ConstructReachingDefinitionBase collect(fa, *this);
StmtSideEffectCollect op(a);
op(fa, h, &collect);
}
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:17,代码来源:ReachingDefinition.C
示例9: assert
void MemoryManager::sweep() {
assert(!sweeping());
if (debug) checkHeap();
collect("MM::sweep");
m_sweeping = true;
SCOPE_EXIT { m_sweeping = false; };
DEBUG_ONLY size_t num_sweepables = 0, num_natives = 0;
// iterate until both sweep lists are empty. Entries can be added or
// removed from either list during sweeping.
do {
while (!m_sweepables.empty()) {
num_sweepables++;
auto obj = m_sweepables.next();
obj->unregister();
obj->sweep();
}
while (!m_natives.empty()) {
num_natives++;
assert(m_natives.back()->sweep_index == m_natives.size() - 1);
auto node = m_natives.back();
m_natives.pop_back();
auto obj = Native::obj(node);
auto ndi = obj->getVMClass()->getNativeDataInfo();
ndi->sweep(obj);
// trash the native data but leave the header and object parsable
assert(memset(node+1, kSmallFreeFill, node->obj_offset - sizeof(*node)));
}
} while (!m_sweepables.empty());
DEBUG_ONLY auto napcs = m_apc_arrays.size();
FTRACE(1, "sweep: sweepable {} native {} apc array {}\n",
num_sweepables,
num_natives,
napcs);
if (debug) checkHeap();
// decref apc arrays referenced by this request. This must happen here
// (instead of in resetAllocator), because the sweep routine may use
// g_context.
while (!m_apc_arrays.empty()) {
auto a = m_apc_arrays.back();
m_apc_arrays.pop_back();
a->sweep();
}
}
开发者ID:nadanomics,项目名称:hhvm,代码行数:46,代码来源:memory-manager.cpp
示例10: sort
//排序函数
void sort(int numbers[]){
int bucket[10][SIZE] = {0}; // 定义10个桶
//每个桶第0号记录桶内数字个数
int maxDigit; // 最长几位
int i = 0;
//获得最多位数,确定排序次数
maxDigit = getMaxDigit(numbers);
//printf("maxDigit = %d\n", maxDigit);
for(i = 0; i < maxDigit; i++){
//进行第i位排序
distribute(i, bucket, numbers);
//按序归位
collect(bucket, numbers);
//debug(numbers);
}
}
开发者ID:956237586,项目名称:DataStructure-C,代码行数:19,代码来源:BucketSortBug+V1.1.c
示例11: collect
void PODModel::collect(){
if ( _color.a < 1 ){
return;
}
if ( _nodeIndex == (unsigned char)-1 ){
AlphaMode am;
for ( unsigned int i = 0; i < _pRes->_pod.nNumMeshNode; ++i ){
if ( _color.a < 255 ){
am = ALPHA_BLEND;
}else{
am = _pRes->getAlphaMode(i);
}
PODModelCollector::collect(this, i, am);
}
}else{
collect(_nodeIndex);
}
}
开发者ID:henyouqian,项目名称:arrow,代码行数:18,代码来源:lwPODModel.cpp
示例12: main
int main(int argc, char * argv[])
{
if (argc != 2) {printf("Please provide a matrix");}
int ierr = MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank); //sets rank
MPI_Comm_size(MPI_COMM_WORLD, &size); //gets number of processes
current_pivot = 0;
if (rank == 0) { //master process
get_number_of_rows(argv[1], &numrows);
numcols = numrows + 1; //specified by assignment
int i;
for (i = 1; i < size; i++) { //sending out information to slaves about what rows they are reading.
MPI_Isend(&numrows, 1, MPI_INT, i, MASTER_TO_SLAVE_TAG, MPI_COMM_WORLD, &request);
}
}
else {
MPI_Recv(&numrows, 1, MPI_INT, 0, MASTER_TO_SLAVE_TAG, MPI_COMM_WORLD, &status);
numcols = numrows + 1;
}
if (rank >= numrows) {
ierr = MPI_Finalize();
return 0;
} else if (rank < (numrows % size)) {
numrows = (numrows / size) + 1;
} else {
numrows = (numrows / size);
}
matrix = allocate_matrix(numrows, numcols);
read_rows(argv[1], matrix);
RREF(matrix);
absolute(matrix, &numrows, &numcols);
reduction(matrix, &numrows, &numcols);
get_best_threshold();
collect(matrix);
// print_matrix(matrix, numrows, numcols);
print_matrix(final_matrix, numcols - 1, numcols);
if (rank == 0) {
// output_to_file(final_matrix);
}
free_matrix(matrix, &numrows);
ierr = MPI_Finalize();
}
开发者ID:njfaries,项目名称:fall2015,代码行数:44,代码来源:cp_mpi.c
示例13: hit
HitResponse
Block::collision(GameObject& other, const CollisionHit& )
{
auto player = dynamic_cast<Player*> (&other);
if(player) {
if(player->get_bbox().get_top() > bbox.get_bottom() - SHIFT_DELTA) {
hit(*player);
}
}
// only interact with other objects if...
// 1) we are bouncing
// 2) the object is not portable (either never or not currently)
// 3) the object is being hit from below (baguys don't get killed for activating boxes)
auto portable = dynamic_cast<Portable*> (&other);
auto moving_object = dynamic_cast<MovingObject*> (&other);
auto bomb = dynamic_cast<Bomb*> (&other);
bool is_portable = ((portable != 0) && portable->is_portable());
bool is_bomb = (bomb != 0); // bombs need to explode, although they are considered portable
bool hit_mo_from_below = ((moving_object == 0) || (moving_object->get_bbox().get_bottom() < (bbox.get_top() + SHIFT_DELTA)));
if(bouncing && (!is_portable || is_bomb) && hit_mo_from_below) {
// Badguys get killed
auto badguy = dynamic_cast<BadGuy*> (&other);
if(badguy) {
badguy->kill_fall();
}
// Coins get collected
auto coin = dynamic_cast<Coin*> (&other);
if(coin) {
coin->collect();
}
//Eggs get jumped
auto growup = dynamic_cast<GrowUp*> (&other);
if(growup) {
growup->do_jump();
}
}
return FORCE_MOVE;
}
开发者ID:christ2go,项目名称:supertux,代码行数:44,代码来源:block.cpp
示例14: collect_and_normalize_dependencies
/* Collect (and sort) dependencies of collected parameters */
void collect_and_normalize_dependencies(buffer<expr> & norm_params) {
name_map<expr> new_types;
for (unsigned i = 0; i < m_params.size(); i++) {
expr x = m_params[i];
expr new_type = collect(m_ctx.instantiate_mvars(m_ctx.infer(x)));
new_types.insert(mlocal_name(x), new_type);
}
local_context const & lctx = m_ctx.lctx();
std::sort(m_params.begin(), m_params.end(), [&](expr const & l1, expr const & l2) {
return lctx.get_local_decl(l1)->get_idx() < lctx.get_local_decl(l2)->get_idx();
});
for (unsigned i = 0; i < m_params.size(); i++) {
expr x = m_params[i];
expr type = *new_types.find(mlocal_name(x));
expr new_type = replace_locals(type, i, m_params.data(), norm_params.data());
expr new_param = m_ctx.push_local(local_pp_name(x), new_type, local_info(x));
norm_params.push_back(new_param);
}
}
开发者ID:sakas--,项目名称:lean,代码行数:20,代码来源:aux_definition.cpp
示例15: DEVICE_DEBUG
void
SF1XX::cycle()
{
/* Collect results */
if (OK != collect()) {
DEVICE_DEBUG("collection error");
/* if error restart the measurement state machine */
start();
return;
}
/* schedule a fresh cycle call when the measurement is done */
work_queue(HPWORK,
&_work,
(worker_t)&SF1XX::cycle_trampoline,
this,
USEC2TICK(_conversion_interval));
}
开发者ID:syantek,项目名称:Firmware,代码行数:19,代码来源:sf1xx.cpp
示例16: pattern
void Glob::glob(const Path& pathPattern, std::set<std::string>& files, int options)
{
Path pattern(pathPattern);
pattern.makeDirectory(); // to simplify pattern handling later on
Path base(pattern);
Path absBase(base);
absBase.makeAbsolute();
// In case of UNC paths we must not pop the topmost directory
// (which must not contain wildcards), otherwise collect() will fail
// as one cannot create a DirectoryIterator with only a node name ("\\srv\").
int minDepth = base.getNode().empty() ? 0 : 1;
while (base.depth() > minDepth && base[base.depth() - 1] != "..")
{
base.popDirectory();
absBase.popDirectory();
}
if (pathPattern.isDirectory()) options |= GLOB_DIRS_ONLY;
collect(pattern, absBase, base, pathPattern[base.depth()], files, options);
}
开发者ID:119,项目名称:vdc,代码行数:19,代码来源:Glob.cpp
示例17: DEVICE_DEBUG
void
PX4FLOW::cycle()
{
if (OK != measure()) {
DEVICE_DEBUG("measure error");
}
/* perform collection */
if (OK != collect()) {
DEVICE_DEBUG("collection error");
/* restart the measurement state machine */
start();
return;
}
work_queue(HPWORK, &_work, (worker_t)&PX4FLOW::cycle_trampoline, this,
_measure_ticks);
}
开发者ID:Aerovinci,项目名称:Firmware,代码行数:19,代码来源:px4flow.cpp
示例18: g
void Glob::collect(const Path& pathPattern, const Path& base, const Path& current, const std::string& pattern, std::set<std::string>& files, int options)
{
try
{
std::string pp = pathPattern.toString();
std::string basep = base.toString();
std::string curp = current.toString();
Glob g(pattern, options);
DirectoryIterator it(base);
DirectoryIterator end;
while (it != end)
{
const std::string& name = it.name();
if (g.match(name))
{
Path p(current);
if (p.depth() < pathPattern.depth() - 1)
{
p.pushDirectory(name);
collect(pathPattern, it.path(), p, pathPattern[p.depth()], files, options);
}
else
{
p.setFileName(name);
if (isDirectory(p, (options & GLOB_FOLLOW_SYMLINKS) != 0))
{
p.makeDirectory();
files.insert(p.toString());
}
else if (!(options & GLOB_DIRS_ONLY))
{
files.insert(p.toString());
}
}
}
++it;
}
}
catch (Exception&)
{
}
}
开发者ID:119,项目名称:vdc,代码行数:42,代码来源:Glob.cpp
示例19: invert_word
void invert_word(int ptr, int cp, struct pcp_vars *pcp)
{
register int *y = y_address;
register int gen;
register int exp;
register int length = y[ptr];
for (; length > 1; --length) {
gen = y[ptr + length];
if (gen < 0)
collect(-gen, cp, pcp);
else
invert_generator(gen, 1, cp, pcp);
}
exp = y[ptr + 1];
if (exp != 1)
calculate_power(exp, ptr, cp, pcp);
}
开发者ID:gap-packages,项目名称:anupq,代码行数:20,代码来源:invert.c
示例20: evaluate_list
void evaluate_list (int *queue, int *queue_length, int *list, int depth, struct pcp_vars *pcp)
{
register int *y = y_address;
register int lastg = pcp->lastg;
register int cp = pcp->lused;
register int cp1 = cp + lastg;
register int cp2 = cp1 + lastg;
register int i, a;
for (i = 1; i <= lastg; ++i)
y[cp + i] = 0;
while (depth > 0) {
a = list[depth];
for (i = 1; i <= lastg; ++i)
y[cp1 + i] = 0;
y[cp1 + a] = 1;
/* compute a^power_of_entry */
power (power_of_entry, cp1, pcp);
vector_to_string (cp1, cp2, pcp);
if (y[cp2 + 1] != 0)
collect (-cp2, cp, pcp);
--depth;
}
#ifdef DEBUG
print_array (y, cp + 1, cp + lastg + 1);
printf ("The result is ");
print_array (y, cp + 1, cp + lastg + 1);
#endif
/* now compute word^exponent */
power (exponent, cp, pcp);
setup_word_to_print ("result of collection", cp, cp + lastg + 1, pcp);
/*
if (pcp->m != 0)
*/
setup_echelon (queue, queue_length, cp, pcp);
}
开发者ID:fingolfin,项目名称:gap-osx-binary,代码行数:41,代码来源:formula.c
注:本文中的collect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论