本文整理汇总了C++中getSource函数的典型用法代码示例。如果您正苦于以下问题:C++ getSource函数的具体用法?C++ getSource怎么用?C++ getSource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSource函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: updateOnlineStatus
void HostileReference::addThreat(float fModThreat)
{
iThreat += fModThreat;
// the threat is changed. Source and target unit have to be available
// if the link was cut before relink it again
if (!isOnline())
updateOnlineStatus();
if (fModThreat != 0.0f)
{
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, fModThreat);
fireStatusChanged(event);
}
if (isValid() && fModThreat >= 0.0f)
{
Unit* victim_owner = getTarget()->GetCharmerOrOwner();
if (victim_owner && victim_owner->isAlive())
getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
}
}
开发者ID:MobileDev,项目名称:P-Core,代码行数:20,代码来源:ThreatManager.cpp
示例2: throw
void OpenALRenderableSource::attachALBuffers()
throw(Exception)
{
if (!alBuffersAttached) {
SharedPtr<Sound> sound = getSource()->getSound();
if (!sound->isLoaded())
sound->load();
assert(!sound->isStreaming() && "OpenALRenderableSource can only handle streaming sounds");
// Attachment to a simple sound, just assign the AL buffer to this AL source
ALBufferHandle alBuffer = dynamic_cast<OpenALSimpleSound*>(sound.get())->getAlBuffer();
ALSourceHandle alSource = getALSource();
alSourcei(alSource, AL_BUFFER, alBuffer);
alBuffersAttached = true;
checkAlError();
}
}
开发者ID:vegastrike,项目名称:Vega-Strike-Engine-Source,代码行数:20,代码来源:OpenALRenderableSource.cpp
示例3: getPath
/* getPath */
void getPath(ListRef L, GraphRef G, int u){
int w;
makeEmpty(L);
if(getSource(G) == 0){
printf("Graph Error: calling getPath() on graph without running BFS \n");
exit(1);
}
if(G->color[u] == 1){
return;
}
else{
insertFront(L, u);
w = u;
while(G->distance[w] > 0){
insertFront(L, G->parent[w]);
w = G->parent[w];
}
}
}
开发者ID:hellolgq,项目名称:Graph-ADT,代码行数:21,代码来源:Graph.c
示例4: source_group
bool SourceHDF5::deleteSource(const string &name_or_id) {
boost::optional<H5Group> g = source_group();
bool deleted = false;
if(g) {
// call deleteSource on sources to trigger recursive call to all sub-sources
if (hasSource(name_or_id)) {
// get instance of source about to get deleted
Source source = getSource(name_or_id);
// loop through all child sources and call deleteSource on them
for(auto &child : source.sources()) {
source.deleteSource(child.id());
}
// if hasSource is true then source_group always exists
deleted = g->removeAllLinks(source.name());
}
}
return deleted;
}
开发者ID:G-Node,项目名称:nix,代码行数:20,代码来源:SourceHDF5.cpp
示例5: VlcStream
OutputVlcStream::OutputVlcStream(Encre<libvlc_instance_t>* encre) : VlcStream(encre), m_videoSource(""), m_soundSource("")
{
std::string media;
bool sound = false;
if (!getSource() || (m_videoSource == "" && m_soundSource == ""))
throw "exception to catch in the instance of encre"; //TODO : a better exception
if (m_videoSource != "" && m_soundSource == "")
media = m_videoSource;
else if (m_videoSource == "" && m_soundSource != "")
media = m_soundSource;
else
{
media = m_videoSource;
sound = true;
}
m_media = libvlc_media_new_location(m_encre->getData(), media.c_str());
if (sound)
setOptions(m_soundSource);
}
开发者ID:epitech-labfree,项目名称:encrev2_plugin,代码行数:20,代码来源:OutputVlcStream.cpp
示例6: qt_static_metacall
int ODataObjectModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 18)
qt_static_metacall(this, _c, _id, _a);
_id -= 18;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = getSource(); break;
case 1: *reinterpret_cast< QVariant*>(_v) = getModel(); break;
}
_id -= 2;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setSource(*reinterpret_cast< QString*>(_v)); break;
case 1: setModel(*reinterpret_cast< QVariant*>(_v)); break;
}
_id -= 2;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 2;
}
#endif // QT_NO_PROPERTIES
return _id;
}
开发者ID:ebourne,项目名称:Cascades-Community-Samples,代码行数:41,代码来源:moc_ODataObjectModel.cpp
示例7: main
int main(int argc, char* argv[]){
if( argc != 2 ){
printf("Usage: %s output\n", argv[0]);
exit(1);
}
FILE *out;
out = fopen(argv[1], "w");
GraphRef G = newGraph(10);
ListRef path = newList();
int i;
for( i = 1; i<= 9; i++){
addEdge(G, i, i+1);
}
printGraph(out, G);
BFS(G, 1);
fprintf(out, "Source of G is %d\n", getSource(G));
fprintf(out, "Order of G is %d\n", getOrder(G));
fprintf(out, "BFS called on Graph G with 1 as the source\n");
getPath(path, G, 10);
fprintf(out, "The path from 1 to 10 is:");
printList(out, path);
fprintf(out, "Parent of 10: %d\n", getParent(G, 10));
fprintf(out, "Parent of 2: %d\n", getParent(G, 2));
int dist = getDist(G, 1);
fprintf(out, "Distance from 1 to 1 is %d\n", dist);
fprintf(out, "Distance from 1 to 7 is %d\n", getDist(G, 7));
freeList(&path);
fclose(out);
return(0);
}
开发者ID:FernandoC,项目名称:BFS,代码行数:39,代码来源:GraphTest.c
示例8: getName
DECLARE_EXPORT void Skill::writeElement(XMLOutput *o, const Keyword& tag, mode m) const
{
// Write a reference
if (m == REFERENCE)
{
o->writeElement(tag, Tags::tag_name, getName());
return;
}
// Write the head
if (m != NOHEAD && m != NOHEADTAIL)
o->BeginObject(tag, Tags::tag_name, XMLEscape(getName()));
// Write source field
o->writeElement(Tags::tag_source, getSource());
// Write the custom fields
PythonDictionary::write(o, getDict());
// Write the tail
if (m != NOHEADTAIL && m != NOTAIL) o->EndObject(tag);
}
开发者ID:dhl,项目名称:frePPLe,代码行数:22,代码来源:skill.cpp
示例9: parameters
void Style::recalculate(float z) {
for (const auto& source : sources) {
source->enabled = false;
}
zoomHistory.update(z, data.getAnimationTime());
StyleCalculationParameters parameters(z,
data.getAnimationTime(),
zoomHistory,
data.getDefaultFadeDuration());
for (const auto& layer : layers) {
hasPendingTransitions |= layer->recalculate(parameters);
Source* source = getSource(layer->source);
if (source && layer->needsRendering()) {
source->enabled = true;
if (!source->loaded && !source->isLoading()) source->load();
}
}
}
开发者ID:place-marker,项目名称:mapbox-gl-native,代码行数:22,代码来源:style.cpp
示例10: getFrameID
*/
void TransferRequest::print( ATP_TransferRequest_t * frame ){
Log.Debug("TransferRequest object:"CR);
if ( getFrameType(frame) == ATP_TRANSFER_REQUEST ) Log.Debug("type: ATP_TRANSFER_REQUEST"CR );
if ( getFrameType(frame) == ATP_CHUNK_REQUEST ) Log.Debug( "type: ATP_CHUNK_REQUEST"CR );
if ( getFrameType(frame) == ATP_CHUNK_RESPONSE ) Log.Debug("type: ATP_CHUNK_RESPONSE"CR );
Log.Debug("frameID: %s"CR, getFrameID(frame));
Log.Debug("frameType: %d"CR, getFrameType(frame));
Log.Debug("meshAddress: %l"CR, getMeshAddress(frame));
Log.Debug("datetime: %l"CR, getDatetime(frame));
Log.Debug("atpID: %l"CR, getAtpID(frame));
Log.Debug("version: %d"CR, getVersion(frame));
Log.Debug("topchunk: %d"CR, getTopChunk(frame));
Log.Debug("chunkcount: %d"CR, getChunkCount(frame));
if ( getStatus(frame) == ATP_IDLE ) Log.Debug( "status: ATP_IDLE"CR );
if ( getStatus(frame) == ATP_SUCCESS ) Log.Debug( "status: ATP_SUCCESS"CR );
if ( getStatus(frame) == ATP_FAILED_DURING_TRANSIT ) Log.Debug("status: ATP_FAILED_DURING_TRANSIT"CR );
if ( getStatus(frame) == ATP_FAILED_CHECKSUM ) Log.Debug( "status: ATP_FAILED_CHECKSUM"CR );
if ( getStatus(frame) == ATP_FAILED_ENCRYPTION ) Log.Debug( "status: ATP_FAILED_ENCRYPTION"CR );
if ( getStatus(frame) == ATP_FAILED_COMPRESSION ) Log.Debug("status: ATP_FAILED_COMPRESSION"CR );
if ( getStatus(frame) == ATP_UNSENT ) Log.Debug( "status: ATP_UNSENT"CR );
if ( getStatus(frame) == ATP_SENT ) Log.Debug( "status: ATP_SENT"CR );
if ( getStatus(frame) == ATP_RECEIVED ) Log.Debug( "status: ATP_RECEIVED"CR );
if ( getStatus(frame) == ATP_WORKING ) Log.Debug( "status: ATP_WORKING"CR );
Log.Debug("size: %l"CR, getSize(frame));
Log.Debug("expires: %l"CR, getExpires(frame));
Log.Debug("descriptor: %s"CR, getDescriptor(frame));
Log.Debug("source: %l"CR, getSource(frame));
Log.Debug("destination: %l"CR, getDestination(frame));
Log.Debug("fileName: %s"CR, getFileName(frame));
if ( getBuffer(frame) != 0 ){
Log.Debug("buffer: %s"CR, getBuffer(frame));
}
开发者ID:Votsh,项目名称:waves,代码行数:38,代码来源:TransferRequest.cpp
示例11: lock
void Style::recalculate(float z, TimePoint now) {
uv::writelock lock(mtx);
for (const auto& source : sources) {
source->enabled = false;
}
zoomHistory.update(z, now);
for (const auto& layer : layers) {
layer->updateProperties(z, now, zoomHistory);
if (!layer->bucket) {
continue;
}
util::ptr<Source> source = getSource(layer->bucket->source);
if (!source) {
continue;
}
source->enabled = true;
}
}
开发者ID:whztt07,项目名称:mapbox-gl-native,代码行数:23,代码来源:style.cpp
示例12: fieldsEqual
bool
Message::operator==(const Message& other) const
{
if (getId() != other.getId())
return false;
if (getTimeStamp() != other.getTimeStamp())
return false;
if (getSource() != other.getSource())
return false;
if (getSourceEntity() != other.getSourceEntity())
return false;
if (getDestination() != other.getDestination())
return false;
if (getDestinationEntity() != other.getDestinationEntity())
return false;
return fieldsEqual(other);
}
开发者ID:Aero348,项目名称:dune,代码行数:23,代码来源:Message.cpp
示例13: lock
void Style::recalculate(float z) {
uv::writelock lock(mtx);
for (const auto& source : sources) {
source->enabled = false;
}
zoomHistory.update(z, data.getAnimationTime());
for (const auto& layer : layers) {
layer->updateProperties(z, data.getAnimationTime(), zoomHistory);
if (!layer->bucket) {
continue;
}
Source* source = getSource(layer->bucket->source);
if (!source) {
continue;
}
source->enabled = true;
}
}
开发者ID:jcrocker,项目名称:mapbox-gl-native,代码行数:23,代码来源:style.cpp
示例14: link
void HostileReference::updateOnlineStatus()
{
bool online = false;
bool accessible = false;
if (!isValid())
{
if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid()))
{
link(target, getSource());
}
}
// only check for online status if
// ref is valid
// target is no player or not gamemaster
// target is not in flight
if (isValid() &&
((getTarget()->GetTypeId() != TYPEID_PLAYER || !((Player*)getTarget())->isGameMaster()) ||
!getTarget()->IsTaxiFlying()))
{
Creature* creature = (Creature*) getSourceUnit();
online = getTarget()->isInAccessablePlaceFor(creature);
if (!online)
{
if (creature->AI()->canReachByRangeAttack(getTarget()))
{
online = true; // not accessable but stays online
}
}
else
{
accessible = true;
}
}
setAccessibleState(accessible);
setOnlineOfflineState(online);
}
开发者ID:43094361,项目名称:server,代码行数:37,代码来源:ThreatManager.cpp
示例15: InformationMessage
void SoundEmitter::changeParentSource()
{
InformationMessage("Sound", "SoundEmitter::changeParent : enter") ;
Model::SoundEnvironnement* env = getObject()->getParent<Model::SoundEnvironnement>() ;
if (env)
{
SoundEnvironnement* envView = env->getView<SoundEnvironnement>(m_viewpoint) ;
if (envView)
{
ALuint auxEffectSlot = envView->getAuxEffectSlot() ;
//SoundEnvironnement has changed
if (auxEffectSlot != m_auxEffectSlot)
{
m_auxEffectSlot = auxEffectSlot;
// @todo see filter parameter for occlusion , exclusion case
EFX::applyEffectToSource(getSource(), m_auxEffectSlot) ;
InformationMessage("Sound", "update add reverb") ;
}
else
{
InformationMessage("Sound", "same reverb") ;
}
}
else
{
InformationMessage("Sound", "no envView") ;
}
}
else
{
InformationMessage("Sound", "no environment") ;
}
InformationMessage("Sound", "SoundEmitter::changeParent : leaving") ;
}
开发者ID:BackupTheBerlios,项目名称:projet-univers-svn,代码行数:36,代码来源:sound_emitter.cpp
示例16: getPath
// getPath(): appends to the List L the vertices of a shortest path in G from source to u,
// or appends to L the value NIL if no such path exists
// Preconditions: getSource(G)!=NIL, 1<=u<=getOrder(G)
void getPath(List L, Graph G, int u) {
if(L == NULL) {
printf("Graph Error: calling getPath() on NULL List reference\n");
exit(1);
}
if(G == NULL) {
printf("Graph Error: calling getPath() on NULL Graph reference\n");
exit(1);
}
if(getSource(G)==NIL) {
printf("Graph Error: calling getPath() with NIL source\n");
exit(1);
}
if(u<1 || u>getOrder(G)) {
printf("Graph Error: calling getPath() with out of bounds value\n");
exit(1);
}
if(G->source == u) {
append(L, u);
} else if(G->parent[u] != NIL) {
getPath(L, G, G->parent[u]);
append(L, u);
}
}
开发者ID:UVERkill,项目名称:CMPS101,代码行数:27,代码来源:Graph.c
示例17: TEST_F
/* Description: Create a mamaPublisher with event callbacks and mamaMsg, send the msg using
* mamaPublisher then destroy both.
*
* Expected Result: MAMA_STATUS_OK
*/
TEST_F (MamaPublisherTestC, EventSendWithCallbacks)
{
mamaPublisher publisher = NULL;
mamaTransport tport = NULL;
const char* symbol = getSymbol();
const char* source = getSource();
mamaMsg msg = NULL;
mamaQueue queue = NULL;
mamaPublisherCallbacks* cb = NULL;
int i = 0;
int numPublishers = 10;
pubOnCreateCount = 0;
pubOnErrorCount = 0;
pubOnDestroyCount = 0;
mamaPublisherCallbacks_allocate(&cb);
cb->onError = (mama_publisherOnErrorCb) pubOnError;
cb->onCreate = (mama_publisherOnCreateCb) pubOnCreate;
cb->onDestroy = (mama_publisherOnDestroyCb) pubOnDestroy;
ASSERT_EQ (MAMA_STATUS_OK, mama_open());
ASSERT_EQ (MAMA_STATUS_OK,
mamaMsg_create (&msg));
ASSERT_EQ (MAMA_STATUS_OK,
mamaMsg_addString (msg, symbol, 101, source));
ASSERT_EQ (MAMA_STATUS_OK,
mama_getDefaultEventQueue (mBridge, &queue));
ASSERT_EQ (MAMA_STATUS_OK,
mamaTransport_allocate (&tport));
ASSERT_EQ (MAMA_STATUS_OK,
mamaTransport_create (tport, getTransport(), mBridge));
ASSERT_EQ (MAMA_STATUS_OK,
mamaTransport_setTransportTopicCallback (tport, (mamaTransportTopicCB) transportTopicCb, NULL));
ASSERT_EQ (MAMA_STATUS_OK,
mamaPublisher_createWithCallbacks (&publisher, tport, queue, symbol, source, NULL, cb, NULL));
for (i = 0; i < numPublishers; ++i)
{
ASSERT_EQ (MAMA_STATUS_OK,
mamaPublisher_send (publisher, msg));
}
ASSERT_EQ (MAMA_STATUS_OK,
mamaPublisher_destroy (publisher));
ASSERT_EQ (MAMA_STATUS_OK,
mamaTransport_destroy (tport));
ASSERT_EQ (MAMA_STATUS_OK, mama_close());
ASSERT_EQ (1, pubOnCreateCount);
ASSERT_EQ (0, pubOnErrorCount);
ASSERT_EQ (1, pubOnDestroyCount);
mamaPublisherCallbacks_deallocate(cb);
}
开发者ID:antmd,项目名称:OpenMAMA,代码行数:69,代码来源:publishertest.cpp
示例18: getSource
RenderData Style::getRenderData() const {
RenderData result;
for (const auto& source : sources) {
if (source->enabled) {
result.sources.insert(source.get());
}
}
for (const auto& layer : layers) {
if (layer->visibility == VisibilityType::None)
continue;
if (const BackgroundLayer* background = layer->as<BackgroundLayer>()) {
if (layer.get() == layers[0].get() && background->paint.pattern.value.from.empty()) {
// This is a solid background. We can use glClear().
result.backgroundColor = background->paint.color;
result.backgroundColor[0] *= background->paint.opacity;
result.backgroundColor[1] *= background->paint.opacity;
result.backgroundColor[2] *= background->paint.opacity;
result.backgroundColor[3] *= background->paint.opacity;
} else {
// This is a textured background, or not the bottommost layer. We need to render it with a quad.
result.order.emplace_back(*layer);
}
continue;
}
if (layer->is<CustomLayer>()) {
result.order.emplace_back(*layer);
continue;
}
Source* source = getSource(layer->source);
if (!source) {
Log::Warning(Event::Render, "can't find source for layer '%s'", layer->id.c_str());
continue;
}
for (auto tile : source->getTiles()) {
if (!tile->data || !tile->data->isReady())
continue;
// We're not clipping symbol layers, so when we have both parents and children of symbol
// layers, we drop all children in favor of their parent to avoid duplicate labels.
// See https://github.com/mapbox/mapbox-gl-native/issues/2482
if (layer->is<SymbolLayer>()) {
bool skip = false;
// Look back through the buckets we decided to render to find out whether there is
// already a bucket from this layer that is a parent of this tile. Tiles are ordered
// by zoom level when we obtain them from getTiles().
for (auto it = result.order.rbegin(); it != result.order.rend() && (&it->layer == layer.get()); ++it) {
if (tile->id.isChildOf(it->tile->id)) {
skip = true;
break;
}
}
if (skip) {
continue;
}
}
auto bucket = tile->data->getBucket(*layer);
if (bucket) {
result.order.emplace_back(*layer, tile, bucket);
}
}
}
return result;
}
开发者ID:CapeSepias,项目名称:mapbox-gl-native,代码行数:71,代码来源:style.cpp
示例19: getSource
void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{
if (getSource())
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
}
开发者ID:AwkwardDev,项目名称:mangos-d3,代码行数:5,代码来源:ThreatManager.cpp
示例20: main
int main(int argc, char * argv[]){
int count=0;
//int check = 0;
int u, v;
FILE *in, *out;
char line[MAX_LEN];
char* token;
Graph G;
List path = newList();
// check command line for correct number of arguments
if( argc != 3 ){
printf("Usage: %s <input file> <output file>\n", argv[0]);
exit(1);
}
// open files for reading and writing
in = fopen(argv[1], "r");
out = fopen(argv[2], "w");
if( in==NULL ){
printf("Unable to open file %s for reading\n", argv[1]);
exit(1);
}
if( out==NULL ){
printf("Unable to open file %s for writing\n", argv[2]);
exit(1);
}
/* read each line of input file, then count and print tokens */
while(fgets(line, MAX_LEN, in) != NULL) {
count++;
// char *strtok(char *str, const char *delim) breaks string str into
// a series of tokens using the delimitrer delim. This function returns a pointer to the
// last token found in string. A null pointer is returned if there are no tokens left to retrieve.
token = strtok(line, " \n");
// int atoi(const char *str), This function returns the converted integral number as an int value.
// If no valid conversion could be performed, it returns zero.
// It converts char to int.
if(count == 1) {
// Takes in the first number as a token, sets a graph of that size
G = newGraph(atoi(token));
}
else {
// Here we want to read in both numbers
u = atoi(token);
token = strtok(NULL, " \n");
v = atoi(token);
if( u != 0 || v != 0) {
addEdge(G, u, v);
}
else if (u == 0 && v == 0) {
//check = 1;
}
}
}
printGraph(out, G);
while( fgets(line, MAX_LEN, in) != NULL) {
token = strtok(line, " \n");
u = atoi(token);
token = strtok(NULL, " \n");
v = atoi(token);
if( u != NIL) {
BFS(G, u);
clear(path);
getPath(path, G, v);
if(u != NIL ) {
fprintf(out, "The distance from %d to %d is %d\n", getSource(G), v, getDist(G, v));
fprintf(out, "A shortest %d-%d path is: ", getSource(G), v);
printList(out, path);
fprintf(out, "\n");
}
else {
fprintf(out, "There is no %d-%d path", getSource(G), v);
fprintf(out, "\n");
}
}
}
freeGraph(&G);
freeList(&path);
/* close files */
fclose(in);
fclose(out);
return(0);
}
开发者ID:androbbi,项目名称:CMPS-101-Algorithms-And-Abstract-Data-Types,代码行数:90,代码来源:FindPath.c
注:本文中的getSource函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论