本文整理汇总了C++中Source函数的典型用法代码示例。如果您正苦于以下问题:C++ Source函数的具体用法?C++ Source怎么用?C++ Source使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Source函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintHeader
static void PrintHeader(const Proto* f)
{
printf("\n%s <%s:%d> (%d instruction%s, %d bytes at %p)\n",
IsMain(f)?"main":"function",Source(f),f->lineDefined,
S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f));
printf("%d%s param%s, %d stack%s, %d upvalue%s, ",
f->numparams,f->is_vararg?"+":"",SS(f->numparams),S(f->maxstacksize),
S(f->nups));
printf("%d local%s, %d constant%s, %d function%s\n",
S(f->sizelocvars),S(f->sizek),S(f->sizep));
}
示例2: GetError
CString GetError(_com_error &e)
{
CString MsgBug;
_bstr_t Source(e.Source());
_bstr_t Description(e.Description());
MsgBug.Format( "Ups!!! \nSource = %s\nDescription= %s\n",(LPCSTR)Source, (LPCSTR)Description );
#ifdef _DEBUG
AfxMessageBox( MsgBug, MB_OK | MB_ICONERROR );
#endif
return MsgBug;
}
示例3: lock
void Nym::DisplayStatistics(String& strOutput) const
{
sLock lock(shared_lock_);
strOutput.Concatenate("Source for ID:\n%s\n", Source().asString()->Get());
strOutput.Concatenate("Description: %s\n\n", m_strDescription->Get());
strOutput.Concatenate("%s", "\n");
strOutput.Concatenate("==> Name: %s\n", Alias().c_str());
strOutput.Concatenate(" Version: %s\n", m_strVersion->Get());
auto theStringID = String::Factory(ID());
strOutput.Concatenate("Nym ID: %s\n", theStringID->Get());
}
示例4: TRACE
status_t
AVFormatReader::Sniff(int32* _streamCount)
{
TRACE("AVFormatReader::Sniff\n");
BPositionIO* source = dynamic_cast<BPositionIO*>(Source());
if (source == NULL) {
TRACE(" not a BPositionIO, but we need it to be one.\n");
return B_NOT_SUPPORTED;
}
Stream* stream = new(std::nothrow) Stream(source,
&fSourceLock);
if (stream == NULL) {
ERROR("AVFormatReader::Sniff() - failed to allocate Stream\n");
return B_NO_MEMORY;
}
ObjectDeleter<Stream> streamDeleter(stream);
status_t ret = stream->Open();
if (ret != B_OK) {
TRACE(" failed to detect stream: %s\n", strerror(ret));
return ret;
}
delete[] fStreams;
fStreams = NULL;
int32 streamCount = stream->CountStreams();
if (streamCount == 0) {
TRACE(" failed to detect any streams: %s\n", strerror(ret));
return B_ERROR;
}
fStreams = new(std::nothrow) Stream*[streamCount];
if (fStreams == NULL) {
ERROR("AVFormatReader::Sniff() - failed to allocate streams\n");
return B_NO_MEMORY;
}
memset(fStreams, 0, sizeof(Stream*) * streamCount);
fStreams[0] = stream;
streamDeleter.Detach();
#ifdef TRACE_AVFORMAT_READER
dump_format(const_cast<AVFormatContext*>(stream->Context()), 0, "", 0);
#endif
if (_streamCount != NULL)
*_streamCount = streamCount;
return B_OK;
}
示例5: srcHook
/*
* srcHook - run a specified source hook
*/
static vi_rc srcHook( hooktype num, vi_rc lastrc )
{
vars *v;
srcline sline;
vi_rc rc;
if( hookRun & num ) {
return( lastrc );
}
/*
* check script type
*/
v = GetHookVar( num );
/*
* run script, if we have one
*/
if( v != NULL ) {
if( num == SRC_HOOK_COMMAND ) {
VarAddGlobalStr( "Com", CommandBuffer );
}
// if( num == SRC_HOOK_MODIFIED ) {
// lastrc = LastEvent;
// }
/*
* set up for and run script
*/
hookRun |= num;
LastRetCode = lastrc;
rc = Source( v->value, srcHookData, &sline );
/*
* if we had a command hook, look for replacement variable
*/
if( num == SRC_HOOK_COMMAND ) {
v = VarFind( "Com", NULL );
if( v != NULL ) {
strcpy( CommandBuffer, v->value );
}
}
/*
* we are done now, reset and go back
*/
LastRetCode = ERR_NO_ERR;
hookRun &= ~num;
DCUpdateAll();
return( rc );
}
return( lastrc );
} /* srcHook */
示例6: Source
const Source Skin::source(std::string ParamName) const
{
for(uint i=0; i< this->NrSources(); i++) {
const Source& src = this->source(i);
std::string Name =
src.technique_common().accessor().param(0).name();
if(Name == ParamName) return src;
}
return Source();
}
示例7: Source
void ShadowView::ConstrainCamera()
{
if( mPointLight && mShadowPlane )
{
// Constrain camera to look directly at center of shadow plane. (mPointLight position
// is under control of application, can't use transform inheritance)
Constraint cameraOrientationConstraint =
Constraint::New<Quaternion> ( Actor::ROTATION,
Source( mShadowPlane, Actor::WORLD_POSITION ),
Source( mPointLight, Actor::WORLD_POSITION ),
Source( mShadowPlane, Actor::WORLD_ROTATION ),
&LookAt );
mCameraActor.ApplyConstraint( cameraOrientationConstraint );
Constraint pointLightPositionConstraint = Constraint::New<Vector3>( Actor::POSITION, Source( mPointLight, Actor::WORLD_POSITION ), EqualToConstraint() );
mCameraActor.ApplyConstraint( pointLightPositionConstraint );
}
}
示例8: ASSERT
void CObjectImageArray::GenerateGlowImage (int iRotation) const
// GenerateGlowImage
//
// Generates a mask that looks like a glow. The mask is 0 for all image pixels
// and for all pixels where there is no glow (thus we can optimize painting
// of the glow by ignoring 0 values)
{
ASSERT(iRotation >= 0 && iRotation < m_iRotationCount);
// Source
if (m_pImage == NULL)
return;
CG16bitImage &Source(*m_pImage->GetImage());
// Allocate the array of images (if not already allocated)
if (m_pGlowImages == NULL)
m_pGlowImages = new CG16bitImage[m_iRotationCount];
// If the image for this rotation has already been initialized, then
// we're done
if (!m_pGlowImages[iRotation].IsEmpty())
return;
// Otherwise we need to create the glow mask. The glow image is larger
// than the object image (by GLOW_SIZE)
int cxSrcWidth = RectWidth(m_rcImage);
int cySrcHeight = RectHeight(m_rcImage);
int cxGlowWidth = cxSrcWidth + 2 * GLOW_SIZE;
int cyGlowHeight = cySrcHeight + 2 * GLOW_SIZE;
if (m_pGlowImages[iRotation].Create(cxGlowWidth, cyGlowHeight, 8) != NOERROR)
{
m_pGlowImages[iRotation].DiscardSurface();
kernelDebugLogMessage("Unable to create image");
return;
}
RECT rcSrc;
rcSrc.left = ComputeSourceX(0);
rcSrc.top = m_rcImage.top + (iRotation * cySrcHeight);
rcSrc.right = rcSrc.left + cxSrcWidth;
rcSrc.bottom = rcSrc.top + cySrcHeight;
m_pGlowImages[iRotation].DrawGlowImage(0, 0, Source, rcSrc.left,
rcSrc.top, rcSrc.right, rcSrc.bottom, 4);
}
示例9: Codec
// -----------------------------------------------------------------------------
// CMceSrvStream::IsEqual
// -----------------------------------------------------------------------------
//
TBool CMceSrvStream::IsEqual( const CMceSrvStream& aStream ) const
{
TBool equal = EFalse;
if ( &aStream )
{
equal = Codec().Id() == aStream.Codec().Id() &&
Source().Data().Id() == aStream.Source().Data().Id() &&
Sink().Data().Id() == aStream.Sink().Data().Id();
}
return equal;
}
示例10: alternate_import_constructor_test
int alternate_import_constructor_test(Epetra_Comm& Comm) {
int rv=0;
int nodes_per_proc=10;
int numprocs = Comm.NumProc();
int mypid = Comm.MyPID();
// Only run if we have multiple procs & MPI
if(numprocs==0) return 0;
#ifndef HAVE_MPI
return 0;
#endif
// Build Map 1 - linear
Epetra_Map Map1((long long)-1,nodes_per_proc,(long long)0,Comm);
// Build Map 2 - mod striped
std::vector<long long> MyGIDs(nodes_per_proc);
for(int i=0; i<nodes_per_proc; i++)
MyGIDs[i] = (mypid*nodes_per_proc + i) % numprocs;
Epetra_Map Map2((long long)-1,nodes_per_proc,&MyGIDs[0],(long long)0,Comm);
// For testing
Epetra_LongLongVector Source(Map1), Target(Map2);
// Build Import 1 - normal
Epetra_Import Import1(Map2,Map1);
rv = rv|| test_import_gid("Alt test: 2 map constructor",Source,Target, Import1);
// Build Import 2 - no-comm constructor
int Nremote=Import1.NumRemoteIDs();
const int * RemoteLIDs = Import1.RemoteLIDs();
std::vector<int> RemotePIDs(Nremote+1); // I hate you, stl vector....
std::vector<int> AllPIDs;
Epetra_Util::GetPids(Import1,AllPIDs,true);
for(int i=0; i<Nremote; i++) {
RemotePIDs[i]=AllPIDs[RemoteLIDs[i]];
}
Epetra_Import Import2(Import1.TargetMap(),Import1.SourceMap(),Nremote,&RemotePIDs[0],Import1.NumExportIDs(),Import1.ExportLIDs(),Import1.ExportPIDs());
rv = rv || test_import_gid("Alt test: no comm constructor",Source,Target,Import2);
// Build Import 3 - Remotes only
Epetra_Import Import3(Import1.TargetMap(),Import1.SourceMap(),Nremote,&RemotePIDs[0]);
rv = rv || test_import_gid("Alt test: remote only constructor",Source,Target, Import3);
return rv;
}
示例11: speech_loc
/** This is the place where speech, poses, and \@emits by thing should be
* heard. For things and players, it's the loc; for rooms, it's the room
* itself; for exits, it's the source.
*/
dbref
speech_loc(dbref thing)
{
if (!RealGoodObject(thing))
return NOTHING;
switch (Typeof(thing)) {
case TYPE_ROOM:
return thing;
case TYPE_EXIT:
return Source(thing);
default:
return Location(thing);
}
}
示例12: getNetworkConstraints
int NetworkConstraints::getNetworkConstraints(string resFile)
{
try
{
sae::io::MappedGraph* g = sae::io::MappedGraph::Open(graphFile.c_str());
for (auto e = g->Edges(); e->Alive(); e->Next())
{
EData ed = sae::serialization::convert_from_string<EData>(e->Data());
ed.value = 0;
for(auto es = e->Source()->OutEdges(); es->Alive(); es->Next())
{
for(auto ee = es->Target()->OutEdges(); ee->Alive(); ee->Next())
{
if (ee->Target()->GlobalId() == e->Target()->GlobalId())
{
ed.value += sae::serialization::convert_from_string<EData>(es->Data()).attribute[0] *
sae::serialization::convert_from_string<EData>(ee->Data()).attribute[0];
break;
}
}
}
e->Data() = sae::serialization::convert_to_string<EData>(ed);
}
ofstream outfile(resFile);
for (auto v = g->Vertices(); v->Alive(); v->Next())
{
double value = 0;
VData vd = sae::serialization::convert_from_string<VData>(v->Data());
for(auto e = v->OutEdges(); e->Alive(); e->Next())
{
value += sae::serialization::convert_from_string<EData>(e->Data()).value;
}
if(v->OutEdgeCount() > 0)
{
outfile << vd.name << "\t" << value / v->OutEdgeCount() <<"\n";
}
else
{
outfile << vd.name << "\t" << 0 <<"\n";
}
}
cout<<"compute Network Constraints done."<<endl;
}
catch(...)
{
cout << "Network Constraints parameter error" << endl;
return -1;
}
return 0;
}
示例13: ConstrainCamera
void ShadowView::SetShadowPlane(Actor shadowPlane)
{
mShadowPlaneBg = shadowPlane;
mShadowPlane = ImageActor::New();
mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);
mShadowPlane.SetImage(mOutputImage);
mShadowPlane.SetShaderEffect(mShadowRenderShader);
// Rather than parent the shadow plane drawable and have constraints to move it to the same
// position, instead parent the shadow plane drawable on the shadow plane passed in.
mShadowPlaneBg.Add(mShadowPlane);
mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
mShadowPlane.SetZ(1.0f);
ConstrainCamera();
mShadowPlane.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) );
mBlurRootActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) );
}
示例14: Unset
status_t
TAPEReader::Sniff(int32* oStreamCount)
{
Unset();
// prepare about file
mSrcPIO = dynamic_cast<BPositionIO*>(Source());
if (mSrcPIO == NULL)
return B_ERROR;
BMediaIO* mediaIO = dynamic_cast<BMediaIO*>(Source());
if (mediaIO != NULL) {
int32 flags = 0;
mediaIO->GetFlags(&flags);
// This plugin doesn't support streamed data.
// The APEHeader::FindDescriptor function always
// analyze the whole file to find the APE_DESCRIPTOR.
if ((flags & B_MEDIA_STREAMING) == true)
return B_ERROR;
}
int nFunctionRetVal = ERROR_SUCCESS;
mPositionBridgeIO.SetPositionIO(mSrcPIO);
mDecomp = CreateIAPEDecompressEx(&mPositionBridgeIO, &nFunctionRetVal);
if (mDecomp == NULL || nFunctionRetVal != ERROR_SUCCESS)
return B_ERROR;
// prepare about data
mDataSize = static_cast<int64>(mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS))
*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN);
mDecodedData = new char [max_c(BUFFER_SIZE*mDecomp->GetInfo(APE_INFO_CHANNELS),
BLOCK_COUNT*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN))];
mLoadAPECheck = B_OK;
*oStreamCount = 1;
return B_OK;
}
示例15: __
// public Fuse.Drawing.Polygon get_Output() [instance] :185
::g::Fuse::Drawing::Polygon* Stroke::Output()
{
uStackFrame __("Fuse.Entities.Processing.Stroke", "get_Output()");
::g::Fuse::Drawing::Polygon* ret2;
::g::Fuse::Drawing::Polygon* ret3;
if (_output != NULL)
return _output;
if ((_source == NULL) || ((::g::Fuse::IOutput::get_Output_ex(uInterface(uPtr(_source), ::TYPES[2/*Fuse.IOutput<Fuse.Drawing.Polygon>*/]), &ret2), ret2) == NULL))
return NULL;
_output = uPtr((::g::Fuse::IOutput::get_Output_ex(uInterface(uPtr(Source()), ::TYPES[2/*Fuse.IOutput<Fuse.Drawing.Polygon>*/]), &ret3), ret3))->Stroke(::g::Uno::Math::Max1(0.1f, Width()), Offset(), StartCap(), EndCap());
return _output;
}