本文整理汇总了C++中Impl类的典型用法代码示例。如果您正苦于以下问题:C++ Impl类的具体用法?C++ Impl怎么用?C++ Impl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Impl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Impl i;
i.enter_state(active_open{}, closed{}, listen{});
i.enter_state(passive_open{}, closed{}, listen{});
i.enter_state(send_syn{}, closed{}, syn_sent{});
}
示例2: OutputIOProc
static OSStatus OutputIOProc(AudioDeviceID inDevice,
const AudioTimeStamp* /*inNow*/,
const AudioBufferList* /*inputData*/,
const AudioTimeStamp* /*inInputTime*/,
AudioBufferList* outputData,
const AudioTimeStamp* /*inOutputTime*/,
void* inClientData)
{
Impl* impl = reinterpret_cast<Impl*>(inClientData);
switch (impl->m_outputProcState)
{
case kStarting:
impl->m_outputProcState = kRunning;
break;
case kStopRequested:
AudioDeviceStop(inDevice, OutputIOProc);
impl->m_outputProcState = kOff;
return noErr;
default:
break;
}
/*
char buf[512] = {0};
sprintf(buf, "Received %i bytes of audio data\n",
inputData->mBuffers[0].mDataByteSize);
impl->m_logger(2, buf);*/
impl->read(reinterpret_cast<unsigned char*>(outputData->mBuffers[0].mData),
outputData->mBuffers[0].mDataByteSize / impl->m_format.mBytesPerFrame);
return noErr;
}
示例3: LOGE
la_int64_t OdinPatcher::Impl::laSkipCb(archive *a, void *userdata,
la_int64_t request)
{
(void) a;
Impl *impl = static_cast<Impl *>(userdata);
bool ret = true;
#ifdef __ANDROID__
if (impl->fd >= 0) {
if (lseek64(impl->fd, request, SEEK_CUR) < 0) {
LOGE("%s: Failed to seek: %s", impl->info->inputPath().c_str(),
strerror(errno));
ret = false;
}
} else {
#endif
if (!impl->laFile.seek(request, io::File::SeekCurrent)) {
LOGE("%s: Failed to seek: %s", impl->info->inputPath().c_str(),
impl->laFile.errorString().c_str());
ret = false;
}
#ifdef __ANDROID__
}
#endif
if (ret) {
impl->bytes += request;
impl->updateProgress(impl->bytes, impl->maxBytes);
} else {
impl->error = ErrorCode::FileSeekError;
}
return ret ? request : -1;
}
示例4: StartRoutineWrapper
static void* StartRoutineWrapper(void* data)
{
Impl* impl = (Impl*) data;
impl->StartRoutine(impl->Data);
return NULL;
}
示例5: main
int main()
{
Impl impl;
impl.run();
Interface& intf = impl;
intf.run();
return 0;
}
示例6: lookupAdapter
VampFeatureList *
PluginAdapterBase::Impl::vampGetRemainingFeatures(VampPluginHandle handle)
{
#ifdef DEBUG_PLUGIN_ADAPTER
std::cerr << "PluginAdapterBase::Impl::vampGetRemainingFeatures(" << handle << ")" << std::endl;
#endif
Impl *adapter = lookupAdapter(handle);
if (!adapter) return 0;
return adapter->getRemainingFeatures((Plugin *)handle);
}
示例7: lookupAdapter
VampFeatureList *
PluginAdapterBase::Impl::vampProcess(VampPluginHandle handle,
const float *const *inputBuffers,
int sec,
int nsec)
{
#ifdef DEBUG_PLUGIN_ADAPTER
std::cerr << "PluginAdapterBase::Impl::vampProcess(" << handle << ", " << sec << ", " << nsec << ")" << std::endl;
#endif
Impl *adapter = lookupAdapter(handle);
if (!adapter) return 0;
return adapter->process((Plugin *)handle, inputBuffers, sec, nsec);
}
示例8: MessageRouter
static LRESULT WINAPI MessageRouter(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_CREATE)
{
SetWindowLong(hWnd, 0, (LONG)lParam);
}
else
{
Impl* pThis = (Impl*)GetWindowLong(hWnd, 0);
if (pThis != nullptr)
{
return pThis->WndProc(hWnd,message,wParam,lParam);
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
示例9: read
la_ssize_t OdinPatcher::Impl::laReadCb(archive *a, void *userdata,
const void **buffer)
{
(void) a;
Impl *impl = static_cast<Impl *>(userdata);
*buffer = impl->laBuf;
uint64_t bytesRead;
bool ret = true;
#ifdef __ANDROID__
if (impl->fd >= 0) {
ssize_t n = read(impl->fd, impl->laBuf, sizeof(impl->laBuf));
if (n < 0) {
LOGE("%s: Failed to read: %s", impl->info->inputPath().c_str(),
strerror(errno));
ret = false;
} else {
bytesRead = n;
}
} else {
#endif
ret = impl->laFile.read(impl->laBuf, sizeof(impl->laBuf), &bytesRead);
if (!ret && impl->laFile.error() == io::File::ErrorEndOfFile) {
ret = true;
}
if (!ret) {
LOGE("%s: Failed to read: %s", impl->info->inputPath().c_str(),
impl->laFile.errorString().c_str());
}
#ifdef __ANDROID__
}
#endif
if (ret) {
impl->bytes += bytesRead;
impl->updateProgress(impl->bytes, impl->maxBytes);
} else {
impl->error = ErrorCode::FileReadError;
}
return ret ? (la_ssize_t) bytesRead : -1;
}
示例10: MyThread
static DWORD WINAPI MyThread(
LPVOID lpThreadParameter
){
Impl *This = (Impl*)lpThreadParameter;
DWORD threadidx = GetCurrentThreadId();
while (!This->m_exit){
if (WAIT_OBJECT_0 == This->m_queueSemaphore.WaitAndDec(1000))
{
std::shared_ptr<MyTaskData> task;
task = This->getTaskAndPop(threadidx);
assert(task);
// run
task->Run();
}
}
return 0;
}
示例11: connect
void connect(const std::string& srcPortName, Impl& dstImpl,
const std::string& dstPortName)
{
if (!hasOutputPort(srcPortName))
throwPortError(srcPortName);
if (!dstImpl.hasInputPort(dstPortName))
throwPortError(dstPortName);
// The value on the output port may already be set
if (!dstImpl._manuallySetPortsMap.count(dstPortName))
std::runtime_error(std::string("The value on port: ") +
dstPortName + "is already set");
_outputMap.find(srcPortName)
->second.connect(dstImpl._inputMap.find(dstPortName)->second);
}
示例12: main
int main (int argc, char* argv[])
{
Impl impl;
Global& global = impl;
A& a = impl;
B& b = impl;
impl.A1();
impl.B1();
impl.AB1();
impl.AB2();
impl.AB3();
std::cout << std::endl;
a.A1();
b.B1();
std::cout << std::endl;
a.AB1();
a.AB2();
a.AB3();
std::cout << std::endl;
b.AB1();
b.AB2();
b.AB3();
std::cout << std::endl;
global.A1();
global.B1();
global.AB1();
global.AB2();
// global.AB3(); // Does not compile
return 0;
}
示例13: put
void put(const K& k, U v)
{
if (!v)
impl.erase(k);
else
impl.insert(k, std::move(v));
}
示例14:
const V *search(const K& k) const
{
const_iterator it = impl.find(k);
if (it == impl.end())
return nullptr;
return &it->second;
}
示例15: insert
void insert(const K& k, V v)
{
// As far as I can tell, this is the simplest way to
// implement move-only insert-with-replacement.
iterator it = impl.lower_bound(k);
// invariant: if it is valid, it->first >= k
if (it != impl.end() && it->first == k)
it->second = std::move(v);
else
it = impl.insert(std::pair<K, V>(std::move(k), std::move(v))).first;
return (void)&it->second;
}