本文整理汇总了C++中Channel函数的典型用法代码示例。如果您正苦于以下问题:C++ Channel函数的具体用法?C++ Channel怎么用?C++ Channel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Channel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: caml_ml_flush_partial
CAMLprim value caml_ml_flush_partial(value vchannel)
{
CAMLparam1 (vchannel);
struct channel * channel = Channel(vchannel);
int res;
if (channel->fd == -1) CAMLreturn(Val_true);
Lock(channel);
res = caml_flush_partial(channel);
Unlock(channel);
CAMLreturn (Val_bool(res));
}
示例2: caml_ml_output_partial
CAMLprim value caml_ml_output_partial(value vchannel, value buff, value start,
value length)
{
CAMLparam4 (vchannel, buff, start, length);
struct channel * channel = Channel(vchannel);
int res;
Lock(channel);
res = caml_putblock(channel, &Byte(buff, Long_val(start)), Long_val(length));
Unlock(channel);
CAMLreturn (Val_int(res));
}
示例3: onAddChannelButtonPressed
void MainWindow::onAddChannelButtonPressed()
{
if (m_session.isValid())
{
QString name = ui->channelNameEdit->text();
QString description = ui->channelDescriptionEdit->text();
QString url = ui->channelUrlEdit->text();
m_applyChannelQuery->setQuery(Channel(name,description,url),m_session);
m_applyChannelQuery->doRequest();
}
}
示例4: main
int main(void)
{
int i, j;
unsigned short CRC_Xmit;
unsigned short CRC_Recv;
int Detected_Count = 0;
int Okay_Count = 0;
/* Initialize. */
for (i = 0; i < 1024; i++) {
Raw_Data[i] = (unsigned char)i;
}
CRC_Xmit = CRC_Clear();
Initialize_Noise(1.0e-5);
/* Compute the CRC checksum. */
for (i = 0; i < 1024; i++) {
CRC_Xmit = CRC_Update(CRC_Xmit, Raw_Data[i]);
}
CRC_Xmit = CRC_Finish(CRC_Xmit);
/* Now loop many times sending the block of data through the channel. */
for (i = 0; i < 1024; i++) {
CRC_Recv = CRC_Clear();
for (j = 0; j < 1024; j++) {
CRC_Recv = CRC_Update(CRC_Recv, Channel(Raw_Data[j]));
}
CRC_Recv = CRC_Update(CRC_Recv, Channel((CRC_Xmit & 0xFF00) >> 8));
CRC_Recv = CRC_Update(CRC_Recv, Channel(CRC_Xmit & 0x00FF));
if (CRC_Recv != 0) Detected_Count++;
else Okay_Count++;
}
printf("Blocks with detected errors: %d\n", Detected_Count);
printf("Blocks okay: %d\n", Okay_Count);
return 0;
}
示例5: string2qstring
SensorDataSet SensorDB::ExecuteSQL_SelectFromSensorDataTable(std::string sqlcommand)
{
SensorDataSet ds;
ChannelList channelist;
int channel_num;
int datatype_id;
int operator_id;
int device_id;
int position_id;
int activity_id;
int activitybeginframe_id;
int activityendframe_id;
double samplerate;
QDateTime createtime;
if(db.isOpen()){
QSqlQuery query;
QString sqlcmd = string2qstring(sqlcommand);
if(query.exec(sqlcmd)){
while(query.next()){
datatype_id = query.value("DataTypeID").toInt();
activity_id = query.value("ActivityID").toInt();
device_id = query.value("DeviceID").toInt();
operator_id = query.value("OperatorID").toInt();
position_id = query.value("PositionID").toInt();
activitybeginframe_id = query.value("ActivityBeginFrameID").toInt();
activityendframe_id = query.value("ActivityEndFrameID").toInt();
samplerate = query.value("SampleRate").toDouble();
createtime = query.value("CreateTime").toDateTime();
channel_num = query.value("TotalChannelNum").toInt();
channelist.clear();
for(int i=1;i<=channel_num;i++){
if(query.value(i).isNull()){
break;
}
string ch = "channel_"+int2string(i);
//qDebug() << query.value(string2qstring(ch.c_str())).toString();
channelist.push_back(Channel(query.value(string2qstring(ch.c_str())).toString().toStdString()));
//qDebug() << string2qstring((channelist[channelist.size()-1].ToString()));
}
ds.PushBackSensorData(SensorData(channelist,channel_num,datatype_id,operator_id,device_id,position_id,
activity_id,activitybeginframe_id,activityendframe_id, samplerate,createtime));
}
}
else{
qDebug()<<query.lastError();
}
}
else{
qDebug()<<"DataBase is not opened";
}
return ds;
}
示例6: stream_of_channel
/* converts a Caml channel to a C FILE* stream */
static FILE * stream_of_channel(value chan, const char * mode) {
int des;
FILE * res ;
struct channel *c_chan = Channel(chan) ;
if(c_chan==NULL)
return NULL;
des = dup(c_chan->fd) ;
res = fdopen(des, mode) ;
if (des < 0 || res == NULL) {
caml_failwith("failed to duplicate caml channel");
}
return res ;
}
示例7: caml_ml_input_int
CAMLprim value caml_ml_input_int(value vchannel)
{
CAMLparam1 (vchannel);
struct channel * channel = Channel(vchannel);
intnat i;
Lock(channel);
i = caml_getword(channel);
Unlock(channel);
#ifdef ARCH_SIXTYFOUR
i = (i << 32) >> 32; /* Force sign extension */
#endif
CAMLreturn (Val_long(i));
}
示例8: ForwardTransaction
void OutgoingResourceLimiter::ForwardMessage(string_t type, uint160 hash)
{
if (type == "tx")
return ForwardTransaction(hash);
string_t channel = Channel(type);
with_msg_as_instance_of_(type, hash,
if (channel == "trade")
flexnode.tradehandler.BroadcastMessage(msg);
else if (channel == "relay")
flexnode.relayhandler.BroadcastMessage(msg);
else if (channel == "deposit")
flexnode.deposit_handler.BroadcastMessage(msg);
)
}
示例9: Channel
// returns a status message regarding the successful or unsuccesful
// creation of a channel
std::string IRCCommandHandler::createChannel() {
// CREATECHANNEL channelname username
std::string channel {arguments[0]};
std::string user {arguments[1]};
std::string result;
if (channels.count(channel) || channel == "server") {
result = "Error: Channel '"+channel+"' already exists";
}
else {
channels.emplace(channel, Channel(channel));
channels.at(channel).addUser(user);
result = "Successfully created channel '"+channel+"'";
}
return result;
}
示例10: VLOG
boost::system::error_code RtspService::createChannel(uint32_t uiChannelId, const std::string& sChannelName, const AudioChannelDescriptor& audioDescriptor)
{
VLOG(2) << "createChannel: " << uiChannelId;
boost::mutex::scoped_lock l(m_channelLock);
ChannelMap_t::iterator it = m_mChannels.find(uiChannelId);
if (it != m_mChannels.end())
{
return boost::system::error_code(boost::system::errc::file_exists, boost::system::get_generic_category());
}
else
{
m_qChannelsToBeAdded.push_back(Channel(uiChannelId, sChannelName, audioDescriptor));
return boost::system::error_code();
}
return boost::system::error_code();
}
示例11: SimulateRead
string SimulateRead(const SequencingParameters& p,
const std::string& tpl,
RandomNumberGenerator& rng)
{
std::string read;
read.reserve(tpl.length() * 2);
int pos = 0;
while (pos < (int)tpl.length())
{
char base = tpl[pos];
char prevBase = pos > 0 ? tpl[pos-1] : 'N';
int channel = Channel(base);
//
// Tabulate the different possible move probabilities, then choose one
//
bool canMerge = base == prevBase;
vector<double> errorProbs = ErrorProbs(p, channel, canMerge);
int choice = rng.RandomChoice(errorProbs);
if (choice == (int) errorProbs.size() - 1) { // Match
read.push_back(base);
pos++;
} else if (choice < 4) { // Insert
vector<double> insertProbs = vector<double>(errorProbs.begin(),
errorProbs.begin() + 4);
int eChannel = rng.RandomChoice(insertProbs);
char eBase = "TGAC"[eChannel];
read.push_back(eBase);
} else if (choice == 4) { // Dark
pos++;
} else if (choice == 5) { // Miscall
read.push_back(rng.RandomBase());
pos++;
} else { // Merge
assert (canMerge);
pos++;
}
}
return read;
}
示例12: win_filedescr_of_channel
CAMLprim value win_filedescr_of_channel(value vchan)
{
CAMLparam1(vchan);
CAMLlocal1(fd);
struct channel * chan;
HANDLE h;
chan = Channel(vchan);
if (chan->fd == -1) uerror("descr_of_channel", Nothing);
h = (HANDLE) _get_osfhandle(chan->fd);
if (chan->flags & CHANNEL_FLAG_FROM_SOCKET)
fd = win_alloc_socket((SOCKET) h);
else
fd = win_alloc_handle(h);
CRT_fd_val(fd) = chan->fd;
CAMLreturn(fd);
}
示例13: SetStatus
void TransportStreamFilter::SetStatus(bool On) {
cFilter::SetStatus(On);
#if VDRVERSNUM <= 10327
#error "Unfortunately, VDR versions up to 1.3.27 contain a bug that prevents this code from working properly. Please use VDR version 1.3.28 or later."
#endif
//printf("TransportStreamFilter::SetStatus , status is %d, On is %d\n", status, On);
TransportStreamID currentTs=TransportStream(Channel()).GetTransportStreamID();
if (On) {
switch (status) {
case TransportStreamUnknown:
ts=currentTs;
status=Active;
AddFilterData();
break;
case Active:
break; // should not happen
case Inactive:
case OnOtherTransportStream:
if (currentTs == ts) {
status=Active;
AddFilterData();
} else {
status=OnOtherTransportStream;
OtherTransportStream(currentTs);
}
break;
case Deactivated:
break;
}
} else {
switch (status) {
case TransportStreamUnknown:
break;
case Active:
status=Inactive;
RemoveFilterData();
break;
case Inactive:
case OnOtherTransportStream:
break;
case Deactivated:
break;
}
}
//printf("TransportStreamFilter::SetStatus, leaving, status is %d\n", status);
}
示例14: caml_ml_output
CAMLprim value caml_ml_output(value vchannel, value buff, value start,
value length)
{
CAMLparam4 (vchannel, buff, start, length);
struct channel * channel = Channel(vchannel);
intnat pos = Long_val(start);
intnat len = Long_val(length);
Lock(channel);
while (len > 0) {
int written = caml_putblock(channel, &Byte(buff, pos), len);
pos += written;
len -= written;
}
Unlock(channel);
CAMLreturn (Val_unit);
}
示例15: Channel
Channel Channel::downsampleEnergy(unsigned factor) const
{
if(factor>0)
{
unsigned newSize=data.size()/factor;
std::vector<float> target=std::vector<float>(newSize);
float acc;
for(unsigned i=0,j=0;j<newSize;j++)
{
acc=0;
for(unsigned k=0;k<factor && i<data.size();k++)
acc+=sqr(data[i++]);
target[j]=sqrt(acc/factor);
}
return Channel(rate/factor,target);
} else
return *this;
}