本文整理汇总了C++中Broadcast函数的典型用法代码示例。如果您正苦于以下问题:C++ Broadcast函数的具体用法?C++ Broadcast怎么用?C++ Broadcast使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Broadcast函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
JXFSBindingTable::HandleTypeMenu
(
const JIndex index
)
{
JPoint cell;
const JBoolean ok = (GetTableSelection()).GetFirstSelectedCell(&cell);
assert( ok );
const JFSBinding::CommandType newType = kMenuIndexToCmdType [ index-1 ];
if (itsBindingList->SetCommandType(cell.y, newType))
{
TableRefreshRow(cell.y);
Broadcast(DataChanged());
}
}
示例2: InsertRows
void
JXFSBindingTable::AddPattern()
{
if (EndEditing())
{
const JFSBinding* b = itsBindingList->GetDefaultCommand();
JFSBinding::CommandType type;
JBoolean singleFile;
const JString& cmd = b->GetCommand(&type, &singleFile);
const JIndex rowIndex =
itsBindingList->AddBinding("", cmd, type, singleFile);
InsertRows(rowIndex, 1);
BeginEditing(JPoint(kPatternColumn, rowIndex));
Broadcast(DataChanged());
}
}
示例3: while
void Switchboard::Update(float dt)
{
std::vector<MessageTimer>::iterator it = _delayedMessages.begin();
while (it != _delayedMessages.end())
{
(*it)._timeRemaining -= dt;
if ((*it)._timeRemaining <= 0.0f)
{
Broadcast((*it)._message);
it = _delayedMessages.erase(it);
}
else
{
it++;
}
}
}
示例4: AddPattern
void
JXFSBindingTable::Receive
(
JBroadcaster* sender,
const Message& message
)
{
if (sender == itsAddButton && message.Is(JXButton::kPushed))
{
AddPattern();
}
else if (sender == itsRemoveButton && message.Is(JXButton::kPushed))
{
RemovePattern();
}
else if (sender == itsDuplicateButton && message.Is(JXButton::kPushed))
{
DuplicatePattern();
}
else if (sender == itsTypeMenu && message.Is(JXMenu::kNeedsUpdate))
{
UpdateTypeMenu();
}
else if (sender == itsTypeMenu && message.Is(JXMenu::kItemSelected))
{
const JXMenu::ItemSelected* selection =
dynamic_cast<const JXMenu::ItemSelected*>(&message);
assert( selection != NULL );
HandleTypeMenu(selection->GetIndex());
}
else
{
if (sender == &(GetTableSelection()))
{
UpdateButtons();
}
else if (message.Is(JTextEditor::kTextChanged))
{
Broadcast(DataChanged());
}
JXEditTable::Receive(sender, message);
}
}
示例5: qDebug
void ShuffleRound::Shuffle()
{
qDebug() << _group.GetIndex(_local_id) << ": shuffling";
_state = Shuffling;
for(int idx = 0; idx < _shuffle_data.count(); idx++) {
for(int jdx = 0; jdx < _shuffle_data.count(); jdx++) {
if(idx == jdx) {
continue;
}
if(_shuffle_data[idx] != _shuffle_data[jdx]) {
continue;
}
qWarning() << "Found duplicate cipher texts... blaming";
// blame ?
return;
}
}
QVector<QByteArray> out_data;
int blame = OnionEncryptor::GetInstance().Decrypt(_outer_key, _shuffle_data, out_data);
if (blame != -1) {
qWarning() << _group.GetIndex(_local_id) << _local_id.ToString() <<
": failed to decrypt layer due to block at index" << blame;
// blame ?
return;
}
const Id &next = _group.Next(_local_id);
MessageType mtype = (next == Id::Zero) ? EncryptedData : ShuffleData;
QByteArray msg;
QDataStream out_stream(&msg, QIODevice::WriteOnly);
out_stream << mtype << GetId().GetByteArray() << out_data;
_state = ShuffleDone;
if(mtype == EncryptedData) {
Broadcast(msg);
_encrypted_data = out_data;
Verify();
} else {
Send(msg, next);
}
}
示例6: GetDataColCount
void
GRaggedFloatTableData::SetRow
(
const JIndex index,
const JArray<JFloat>& rowData
)
{
const JSize colCount = GetDataColCount();
assert( rowData.GetElementCount() == colCount );
for (JIndex i=1; i<=colCount; i++)
{
JArray<JFloat>* dataCol = itsCols->NthElement(i);
dataCol->SetElement(index, rowData.GetElement(i));
}
Broadcast(JTableData::RectChanged(JRect(index, 1, index+1, colCount+1)));
}
示例7: StopListening
void
JXColorWheel::SetColor
(
const JHSB& hsb
)
{
if (itsColor != hsb)
{
itsColor = hsb;
StopListening(itsBrightnessSlider);
itsBrightnessSlider->SetValue(itsColor.brightness);
ListenTo(itsBrightnessSlider);
Broadcast(ColorChanged());
Refresh();
}
}
示例8: JRound
void
JXColorWheel::Receive
(
JBroadcaster* sender,
const Message& message
)
{
if (sender == itsBrightnessSlider && message.Is(JSliderBase::kMoved))
{
itsColor.brightness = JRound(itsBrightnessSlider->GetValue());
Broadcast(ColorChanged());
Refresh();
}
else
{
JXWidget::Receive(sender, message);
}
}
示例9: stringLock
void VisionApp::SetString(const char* stringName, int32 index, const char* value)
{
BAutolock stringLock(const_cast<BLocker*>(&fSettingsLock));
if (!stringLock.IsLocked()) return;
if (!strcmp(stringName, "timestamp_format")) {
BMessage msg(M_STATE_CHANGE);
msg.AddBool("string", true);
msg.AddString("which", stringName);
Broadcast(&msg);
}
BString tmp;
tmp = value;
fVisionSettings->ReplaceString(stringName, index, tmp);
}
示例10: CVTest2
/* tests wait, signal, and broadcast syscalls */
void CVTest2()
{
int i;
/*will be used later to test ownership condition */
Exec("../test/lock_help", 17);
/* testing lock id range check */
PrintF("\nTest 2 - Accessing invalid cv ID (both below and above valid range):\n",
sizeof("\nTest 2 - Accessing invalid cv ID (both below and above valid range):\n"), 0, 0);
Wait(-1, myLock);
Wait(100, myLock);
/* testing trying to acquire a cv that doesn't exit */
PrintF("Trying to acquire cv that was deleted: \n", sizeof("Trying to acquire cv that was deleted: \n"), 0, 0);
Wait(myCV2, myLock);
PrintF("\nTesting signal, wait, broadcast\n", sizeof("\nTesting signal, wait, broadcast\n"), 0, 0);
/*fork threads to test signal */
Fork(threadTest2_1);
Yield();
Acquire(myLock);
PrintF("Before signal\n", sizeof("Before signal\n"), 0, 0);
Signal(myCV, myLock);
PrintF("After signal\n", sizeof("After signal\n"), 0, 0);
Release(myLock);
/*fork threads to test broadcast*/
Fork(threadTest2_2);
Fork(threadTest2_2);
Fork(threadTest2_2);
for (i = 0; i < 50; i++)
Yield();
Acquire(myLock);
PrintF("Before broadcast\n", sizeof("Before broadcast\n"), 0, 0);
Broadcast(myCV, myLock);
PrintF("After broadcast\n", sizeof("After broadcast\n"), 0, 0);
Release(myLock);
/* tries to access cv created by another process */
PrintF("\nTrying to acquire cv created in another process: \n", sizeof("\nTrying to acquire cv created in another process: \n"), 0, 0);
Wait(4, myLock);
}
示例11: JNoError
JError
JDirInfo::SetContentFilter
(
const JCharacter* regexStr
)
{
if (itsContentRegex != NULL && regexStr == itsContentRegex->GetPattern())
{
return JNoError();
}
JBoolean hadFilter = kJTrue;
JString prevPattern;
if (itsContentRegex == NULL)
{
hadFilter = kJFalse;
itsContentRegex = new JRegex;
assert( itsContentRegex != NULL );
itsContentRegex->SetSingleLine();
}
else
{
prevPattern = itsContentRegex->GetPattern();
}
JError err = itsContentRegex->SetPattern(regexStr);
if (err.OK())
{
ForceUpdate();
Broadcast(SettingsChanged());
}
else if (hadFilter)
{
err = itsContentRegex->SetPattern(prevPattern);
assert_ok( err );
}
else
{
delete itsContentRegex;
itsContentRegex = NULL;
}
return err;
}
示例12: StartCTags
void
GFGLink::ParseClass
(
GFGClass* list,
const JCharacter* filename,
const JCharacter* classname
)
{
JBoolean ok = kJTrue;
if (itsCTagsProcess == NULL)
{
ok = StartCTags();
}
if (ok)
{
itsClassList = list;
itsCurrentClass = classname;
itsCurrentFile = filename;
JConvertToAbsolutePath(filename, "", &itsCurrentFile);
itsCurrentFile.Print(*itsOutputLink);
*itsOutputLink << std::endl;
itsOutputLink->flush();
JBoolean found = kJFalse;
JString result = JReadUntil(itsInputFD, kDelimiter, &found);
if (found)
{
JIndex findex;
while ( result.LocateSubstring("\n", &findex) &&
findex > 1)
{
JString line = result.GetSubstring(1, findex - 1);
result.RemoveSubstring(1, findex);
ParseLine(line);
}
Broadcast(FileParsed());
}
}
}
示例13: SString
void CScriptDebugging::LogError ( SString strFile, int iLine, SString strMsg )
{
SString strText = SString ( "ERROR: %s:%d: %s", strFile.c_str (), iLine, strMsg.c_str () );
if ( !m_bTriggeringOnDebugMessage )
{
m_bTriggeringOnDebugMessage = true;
// Prepare onDebugMessage
CLuaArguments Arguments;
Arguments.PushString ( strMsg.c_str ( ) );
Arguments.PushNumber ( 1 );
// Push the file name (if any)
if ( strFile.length ( ) > 0 )
Arguments.PushString ( strFile.c_str ( ) );
else
Arguments.PushNil ( );
// Push the line (if any)
if ( iLine > -1 )
Arguments.PushNumber ( iLine );
else
Arguments.PushNil ( );
// Call onDebugMessage
g_pGame->GetMapManager ( )->GetRootElement ( )->CallEvent ( "onDebugMessage", Arguments );
m_bTriggeringOnDebugMessage = false;
}
// Log it to the file if enough level
if ( m_uiLogFileLevel >= 1 )
{
PrintLog ( strText );
}
// Log to console
CLogger::LogPrintf( "%s\n", strText.c_str () );
// Tell the players
Broadcast ( CDebugEchoPacket ( strText, 1, 255, 255, 255 ), 1 );
}
示例14: SetData
void
GPrefsMgr::SetInboxes
(
const JPtrArray<JString>& inboxes
)
{
const JSize count = inboxes.GetElementCount();
std::ostringstream data;
data << count;
for (JIndex i=1; i<=count; i++)
{
data << ' ' << *(inboxes.NthElement(i));
}
SetData(kGInboxesID, data);
Broadcast(InboxesChanged());
}
示例15: assert
void
JXRadioGroup::NewSelection
(
JXRadioButton* button
)
{
assert( button != NULL );
if (itsSelection != button)
{
if (itsSelection != NULL)
{
itsSelection->Deselect();
}
itsSelection = button;
itsSelection->Select();
Broadcast(SelectionChanged(itsSelection->GetID()));
}
}