blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
010c222b33f8de4dfd92ba4a5a70e65cbabbf6a7 | 915ac708aeac53125f29bef90c2c047eaed4940e | /Anaconda/pkgs/pyodbc-2.1.9/src/connection.cpp | d195f385e44289f26e42c59f4dc347bab288448e | [] | no_license | bopopescu/newGitTest | c8c480ddd585ef416a5ccb63cbc43e3019f92534 | 5a19f7d01d417a34170a8f760a76e6a8bb7c9274 | refs/heads/master | 2021-05-31T17:00:26.656450 | 2016-06-08T06:43:52 | 2016-06-08T06:43:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 31,626 | cpp |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "pyodbc.h"
#include "connection.h"
#include "cursor.h"
#include "pyodbcmodule.h"
#include "errors.h"
#include "wrapper.h"
#include "cnxninfo.h"
#include "sqlwchar.h"
static char connection_doc[] =
"Connection objects manage connections to the database.\n"
"\n"
"Each manages a single ODBC HDBC.";
static Connection*
Connection_Validate(PyObject* self)
{
Connection* cnxn;
if (self == 0 || !Connection_Check(self))
{
PyErr_SetString(PyExc_TypeError, "Connection object required");
return 0;
}
cnxn = (Connection*)self;
if (cnxn->hdbc == SQL_NULL_HANDLE)
{
PyErr_SetString(ProgrammingError, "Attempt to use a closed connection.");
return 0;
}
return cnxn;
}
static bool Connect(PyObject* pConnectString, HDBC hdbc, bool fAnsi, long timeout)
{
// This should have been checked by the global connect function.
I(PyString_Check(pConnectString) || PyUnicode_Check(pConnectString));
const int cchMax = 600;
if (PySequence_Length(pConnectString) >= cchMax)
{
PyErr_SetString(PyExc_TypeError, "connection string too long");
return false;
}
// The driver manager determines if the app is a Unicode app based on whether we call SQLDriverConnectA or
// SQLDriverConnectW. Some drivers, notably Microsoft Access/Jet, change their behavior based on this, so we try
// the Unicode version first. (The Access driver only supports Unicode text, but SQLDescribeCol returns SQL_CHAR
// instead of SQL_WCHAR if we connect with the ANSI version. Obviously this causes lots of errors since we believe
// what it tells us (SQL_CHAR).)
// Python supports only UCS-2 and UCS-4, so we shouldn't need to worry about receiving surrogate pairs. However,
// Windows does use UCS-16, so it is possible something would be misinterpreted as one. We may need to examine
// this more.
SQLRETURN ret;
if (timeout > 0)
{
Py_BEGIN_ALLOW_THREADS
ret = SQLSetConnectAttr(hdbc, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)timeout, SQL_IS_UINTEGER);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
RaiseErrorFromHandle("SQLSetConnectAttr(SQL_ATTR_LOGIN_TIMEOUT)", hdbc, SQL_NULL_HANDLE);
}
if (!fAnsi)
{
SQLWChar connectString(pConnectString);
Py_BEGIN_ALLOW_THREADS
ret = SQLDriverConnectW(hdbc, 0, connectString, (SQLSMALLINT)connectString.size(), 0, 0, 0, SQL_DRIVER_NOPROMPT);
Py_END_ALLOW_THREADS
if (SQL_SUCCEEDED(ret))
return true;
// The Unicode function failed. If the error is that the driver doesn't have a Unicode version (IM001), continue
// to the ANSI version.
PyObject* error = GetErrorFromHandle("SQLDriverConnectW", hdbc, SQL_NULL_HANDLE);
if (!HasSqlState(error, "IM001"))
{
RaiseErrorFromException(error);
return false;
}
Py_XDECREF(error);
}
SQLCHAR szConnect[cchMax];
if (PyUnicode_Check(pConnectString))
{
Py_UNICODE* p = PyUnicode_AS_UNICODE(pConnectString);
for (Py_ssize_t i = 0, c = PyUnicode_GET_SIZE(pConnectString); i <= c; i++)
{
if (p[i] > 0xFF)
{
PyErr_SetString(PyExc_TypeError, "A Unicode connection string was supplied but the driver does "
"not have a Unicode connect function");
return false;
}
szConnect[i] = (SQLCHAR)p[i];
}
}
else
{
const char* p = PyString_AS_STRING(pConnectString);
memcpy(szConnect, p, (size_t)(PyString_GET_SIZE(pConnectString) + 1));
}
Py_BEGIN_ALLOW_THREADS
ret = SQLDriverConnect(hdbc, 0, szConnect, SQL_NTS, 0, 0, 0, SQL_DRIVER_NOPROMPT);
Py_END_ALLOW_THREADS
if (SQL_SUCCEEDED(ret))
return true;
RaiseErrorFromHandle("SQLDriverConnect", hdbc, SQL_NULL_HANDLE);
return false;
}
PyObject* Connection_New(PyObject* pConnectString, bool fAutoCommit, bool fAnsi, bool fUnicodeResults, long timeout)
{
// pConnectString
// A string or unicode object. (This must be checked by the caller.)
//
// fAnsi
// If true, do not attempt a Unicode connection.
//
// fUnicodeResults
// If true, return strings in rows as unicode objects.
//
// Allocate HDBC and connect
//
HDBC hdbc = SQL_NULL_HANDLE;
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
return RaiseErrorFromHandle("SQLAllocHandle", SQL_NULL_HANDLE, SQL_NULL_HANDLE);
if (!Connect(pConnectString, hdbc, fAnsi, timeout))
{
// Connect has already set an exception.
Py_BEGIN_ALLOW_THREADS
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
Py_END_ALLOW_THREADS
return 0;
}
//
// Connected, so allocate the Connection object.
//
// Set all variables to something valid, so we don't crash in dealloc if this function fails.
Connection* cnxn = PyObject_NEW(Connection, &ConnectionType);
if (cnxn == 0)
{
Py_BEGIN_ALLOW_THREADS
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
Py_END_ALLOW_THREADS
return 0;
}
cnxn->hdbc = hdbc;
cnxn->nAutoCommit = fAutoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
cnxn->searchescape = 0;
cnxn->timeout = 0;
cnxn->unicode_results = fUnicodeResults;
cnxn->conv_count = 0;
cnxn->conv_types = 0;
cnxn->conv_funcs = 0;
//
// Initialize autocommit mode.
//
// The DB API says we have to default to manual-commit, but ODBC defaults to auto-commit. We also provide a
// keyword parameter that allows the user to override the DB API and force us to start in auto-commit (in which
// case we don't have to do anything).
if (fAutoCommit == false)
{
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLSetConnectAttr(cnxn->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)cnxn->nAutoCommit, SQL_IS_UINTEGER);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle("SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT)", cnxn->hdbc, SQL_NULL_HANDLE);
Py_DECREF(cnxn);
return 0;
}
}
TRACE("cnxn.new cnxn=%p hdbc=%d\n", cnxn, cnxn->hdbc);
//
// Gather connection-level information we'll need later.
//
Object info(GetConnectionInfo(pConnectString, cnxn));
if (!info.IsValid())
{
Py_DECREF(cnxn);
return 0;
}
CnxnInfo* p = (CnxnInfo*)info.Get();
cnxn->odbc_major = p->odbc_major;
cnxn->odbc_minor = p->odbc_minor;
cnxn->supports_describeparam = p->supports_describeparam;
cnxn->datetime_precision = p->datetime_precision;
cnxn->varchar_maxlength = p->varchar_maxlength;
cnxn->wvarchar_maxlength = p->wvarchar_maxlength;
cnxn->binary_maxlength = p->binary_maxlength;
return reinterpret_cast<PyObject*>(cnxn);
}
static void _clear_conv(Connection* cnxn)
{
if (cnxn->conv_count != 0)
{
pyodbc_free(cnxn->conv_types);
cnxn->conv_types = 0;
for (int i = 0; i < cnxn->conv_count; i++)
Py_XDECREF(cnxn->conv_funcs[i]);
pyodbc_free(cnxn->conv_funcs);
cnxn->conv_funcs = 0;
cnxn->conv_count = 0;
}
}
static char conv_clear_doc[] =
"clear_output_converters() --> None\n\n"
"Remove all output converter functions.";
static PyObject*
Connection_conv_clear(Connection* cnxn)
{
_clear_conv(cnxn);
Py_RETURN_NONE;
}
static int
Connection_clear(Connection* cnxn)
{
// Internal method for closing the connection. (Not called close so it isn't confused with the external close
// method.)
if (cnxn->hdbc != SQL_NULL_HANDLE)
{
// REVIEW: Release threads? (But make sure you zero out hdbc *first*!
TRACE("cnxn.clear cnxn=%p hdbc=%d\n", cnxn, cnxn->hdbc);
Py_BEGIN_ALLOW_THREADS
if (cnxn->nAutoCommit == SQL_AUTOCOMMIT_OFF)
SQLEndTran(SQL_HANDLE_DBC, cnxn->hdbc, SQL_ROLLBACK);
SQLDisconnect(cnxn->hdbc);
SQLFreeHandle(SQL_HANDLE_DBC, cnxn->hdbc);
Py_END_ALLOW_THREADS
cnxn->hdbc = SQL_NULL_HANDLE;
}
Py_XDECREF(cnxn->searchescape);
cnxn->searchescape = 0;
_clear_conv(cnxn);
return 0;
}
static void
Connection_dealloc(PyObject* self)
{
Connection* cnxn = (Connection*)self;
Connection_clear(cnxn);
PyObject_Del(self);
}
static char close_doc[] =
"Close the connection now (rather than whenever __del__ is called).\n"
"\n"
"The connection will be unusable from this point forward and a ProgrammingError\n"
"will be raised if any operation is attempted with the connection. The same\n"
"applies to all cursor objects trying to use the connection.\n"
"\n"
"Note that closing a connection without committing the changes first will cause\n"
"an implicit rollback to be performed.";
static PyObject*
Connection_close(PyObject* self, PyObject* args)
{
UNUSED(args);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
Connection_clear(cnxn);
Py_RETURN_NONE;
}
static PyObject*
Connection_cursor(PyObject* self, PyObject* args)
{
UNUSED(args);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
return (PyObject*)Cursor_New(cnxn);
}
static PyObject*
Connection_execute(PyObject* self, PyObject* args)
{
PyObject* result = 0;
Cursor* cursor;
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
cursor = Cursor_New(cnxn);
if (!cursor)
return 0;
result = Cursor_execute((PyObject*)cursor, args);
Py_DECREF((PyObject*)cursor);
return result;
}
enum
{
GI_YESNO,
GI_STRING,
GI_UINTEGER,
GI_USMALLINT,
};
struct GetInfoType
{
SQLUSMALLINT infotype;
int datatype; // GI_XXX
};
static const GetInfoType aInfoTypes[] = {
{ SQL_ACCESSIBLE_PROCEDURES, GI_YESNO },
{ SQL_ACCESSIBLE_TABLES, GI_YESNO },
{ SQL_ACTIVE_ENVIRONMENTS, GI_USMALLINT },
{ SQL_AGGREGATE_FUNCTIONS, GI_UINTEGER },
{ SQL_ALTER_DOMAIN, GI_UINTEGER },
{ SQL_ALTER_TABLE, GI_UINTEGER },
{ SQL_ASYNC_MODE, GI_UINTEGER },
{ SQL_BATCH_ROW_COUNT, GI_UINTEGER },
{ SQL_BATCH_SUPPORT, GI_UINTEGER },
{ SQL_BOOKMARK_PERSISTENCE, GI_UINTEGER },
{ SQL_CATALOG_LOCATION, GI_USMALLINT },
{ SQL_CATALOG_NAME, GI_YESNO },
{ SQL_CATALOG_NAME_SEPARATOR, GI_STRING },
{ SQL_CATALOG_TERM, GI_STRING },
{ SQL_CATALOG_USAGE, GI_UINTEGER },
{ SQL_COLLATION_SEQ, GI_STRING },
{ SQL_COLUMN_ALIAS, GI_YESNO },
{ SQL_CONCAT_NULL_BEHAVIOR, GI_USMALLINT },
{ SQL_CONVERT_FUNCTIONS, GI_UINTEGER },
{ SQL_CONVERT_VARCHAR, GI_UINTEGER },
{ SQL_CORRELATION_NAME, GI_USMALLINT },
{ SQL_CREATE_ASSERTION, GI_UINTEGER },
{ SQL_CREATE_CHARACTER_SET, GI_UINTEGER },
{ SQL_CREATE_COLLATION, GI_UINTEGER },
{ SQL_CREATE_DOMAIN, GI_UINTEGER },
{ SQL_CREATE_SCHEMA, GI_UINTEGER },
{ SQL_CREATE_TABLE, GI_UINTEGER },
{ SQL_CREATE_TRANSLATION, GI_UINTEGER },
{ SQL_CREATE_VIEW, GI_UINTEGER },
{ SQL_CURSOR_COMMIT_BEHAVIOR, GI_USMALLINT },
{ SQL_CURSOR_ROLLBACK_BEHAVIOR, GI_USMALLINT },
{ SQL_DATABASE_NAME, GI_STRING },
{ SQL_DATA_SOURCE_NAME, GI_STRING },
{ SQL_DATA_SOURCE_READ_ONLY, GI_YESNO },
{ SQL_DATETIME_LITERALS, GI_UINTEGER },
{ SQL_DBMS_NAME, GI_STRING },
{ SQL_DBMS_VER, GI_STRING },
{ SQL_DDL_INDEX, GI_UINTEGER },
{ SQL_DEFAULT_TXN_ISOLATION, GI_UINTEGER },
{ SQL_DESCRIBE_PARAMETER, GI_YESNO },
{ SQL_DM_VER, GI_STRING },
{ SQL_DRIVER_NAME, GI_STRING },
{ SQL_DRIVER_ODBC_VER, GI_STRING },
{ SQL_DRIVER_VER, GI_STRING },
{ SQL_DROP_ASSERTION, GI_UINTEGER },
{ SQL_DROP_CHARACTER_SET, GI_UINTEGER },
{ SQL_DROP_COLLATION, GI_UINTEGER },
{ SQL_DROP_DOMAIN, GI_UINTEGER },
{ SQL_DROP_SCHEMA, GI_UINTEGER },
{ SQL_DROP_TABLE, GI_UINTEGER },
{ SQL_DROP_TRANSLATION, GI_UINTEGER },
{ SQL_DROP_VIEW, GI_UINTEGER },
{ SQL_DYNAMIC_CURSOR_ATTRIBUTES1, GI_UINTEGER },
{ SQL_DYNAMIC_CURSOR_ATTRIBUTES2, GI_UINTEGER },
{ SQL_EXPRESSIONS_IN_ORDERBY, GI_YESNO },
{ SQL_FILE_USAGE, GI_USMALLINT },
{ SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, GI_UINTEGER },
{ SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, GI_UINTEGER },
{ SQL_GETDATA_EXTENSIONS, GI_UINTEGER },
{ SQL_GROUP_BY, GI_USMALLINT },
{ SQL_IDENTIFIER_CASE, GI_USMALLINT },
{ SQL_IDENTIFIER_QUOTE_CHAR, GI_STRING },
{ SQL_INDEX_KEYWORDS, GI_UINTEGER },
{ SQL_INFO_SCHEMA_VIEWS, GI_UINTEGER },
{ SQL_INSERT_STATEMENT, GI_UINTEGER },
{ SQL_INTEGRITY, GI_YESNO },
{ SQL_KEYSET_CURSOR_ATTRIBUTES1, GI_UINTEGER },
{ SQL_KEYSET_CURSOR_ATTRIBUTES2, GI_UINTEGER },
{ SQL_KEYWORDS, GI_STRING },
{ SQL_LIKE_ESCAPE_CLAUSE, GI_YESNO },
{ SQL_MAX_ASYNC_CONCURRENT_STATEMENTS, GI_UINTEGER },
{ SQL_MAX_BINARY_LITERAL_LEN, GI_UINTEGER },
{ SQL_MAX_CATALOG_NAME_LEN, GI_USMALLINT },
{ SQL_MAX_CHAR_LITERAL_LEN, GI_UINTEGER },
{ SQL_MAX_COLUMNS_IN_GROUP_BY, GI_USMALLINT },
{ SQL_MAX_COLUMNS_IN_INDEX, GI_USMALLINT },
{ SQL_MAX_COLUMNS_IN_ORDER_BY, GI_USMALLINT },
{ SQL_MAX_COLUMNS_IN_SELECT, GI_USMALLINT },
{ SQL_MAX_COLUMNS_IN_TABLE, GI_USMALLINT },
{ SQL_MAX_COLUMN_NAME_LEN, GI_USMALLINT },
{ SQL_MAX_CONCURRENT_ACTIVITIES, GI_USMALLINT },
{ SQL_MAX_CURSOR_NAME_LEN, GI_USMALLINT },
{ SQL_MAX_DRIVER_CONNECTIONS, GI_USMALLINT },
{ SQL_MAX_IDENTIFIER_LEN, GI_USMALLINT },
{ SQL_MAX_INDEX_SIZE, GI_UINTEGER },
{ SQL_MAX_PROCEDURE_NAME_LEN, GI_USMALLINT },
{ SQL_MAX_ROW_SIZE, GI_UINTEGER },
{ SQL_MAX_ROW_SIZE_INCLUDES_LONG, GI_YESNO },
{ SQL_MAX_SCHEMA_NAME_LEN, GI_USMALLINT },
{ SQL_MAX_STATEMENT_LEN, GI_UINTEGER },
{ SQL_MAX_TABLES_IN_SELECT, GI_USMALLINT },
{ SQL_MAX_TABLE_NAME_LEN, GI_USMALLINT },
{ SQL_MAX_USER_NAME_LEN, GI_USMALLINT },
{ SQL_MULTIPLE_ACTIVE_TXN, GI_YESNO },
{ SQL_MULT_RESULT_SETS, GI_YESNO },
{ SQL_NEED_LONG_DATA_LEN, GI_YESNO },
{ SQL_NON_NULLABLE_COLUMNS, GI_USMALLINT },
{ SQL_NULL_COLLATION, GI_USMALLINT },
{ SQL_NUMERIC_FUNCTIONS, GI_UINTEGER },
{ SQL_ODBC_INTERFACE_CONFORMANCE, GI_UINTEGER },
{ SQL_ODBC_VER, GI_STRING },
{ SQL_OJ_CAPABILITIES, GI_UINTEGER },
{ SQL_ORDER_BY_COLUMNS_IN_SELECT, GI_YESNO },
{ SQL_PARAM_ARRAY_ROW_COUNTS, GI_UINTEGER },
{ SQL_PARAM_ARRAY_SELECTS, GI_UINTEGER },
{ SQL_PROCEDURES, GI_YESNO },
{ SQL_PROCEDURE_TERM, GI_STRING },
{ SQL_QUOTED_IDENTIFIER_CASE, GI_USMALLINT },
{ SQL_ROW_UPDATES, GI_YESNO },
{ SQL_SCHEMA_TERM, GI_STRING },
{ SQL_SCHEMA_USAGE, GI_UINTEGER },
{ SQL_SCROLL_OPTIONS, GI_UINTEGER },
{ SQL_SEARCH_PATTERN_ESCAPE, GI_STRING },
{ SQL_SERVER_NAME, GI_STRING },
{ SQL_SPECIAL_CHARACTERS, GI_STRING },
{ SQL_SQL92_DATETIME_FUNCTIONS, GI_UINTEGER },
{ SQL_SQL92_FOREIGN_KEY_DELETE_RULE, GI_UINTEGER },
{ SQL_SQL92_FOREIGN_KEY_UPDATE_RULE, GI_UINTEGER },
{ SQL_SQL92_GRANT, GI_UINTEGER },
{ SQL_SQL92_NUMERIC_VALUE_FUNCTIONS, GI_UINTEGER },
{ SQL_SQL92_PREDICATES, GI_UINTEGER },
{ SQL_SQL92_RELATIONAL_JOIN_OPERATORS, GI_UINTEGER },
{ SQL_SQL92_REVOKE, GI_UINTEGER },
{ SQL_SQL92_ROW_VALUE_CONSTRUCTOR, GI_UINTEGER },
{ SQL_SQL92_STRING_FUNCTIONS, GI_UINTEGER },
{ SQL_SQL92_VALUE_EXPRESSIONS, GI_UINTEGER },
{ SQL_SQL_CONFORMANCE, GI_UINTEGER },
{ SQL_STANDARD_CLI_CONFORMANCE, GI_UINTEGER },
{ SQL_STATIC_CURSOR_ATTRIBUTES1, GI_UINTEGER },
{ SQL_STATIC_CURSOR_ATTRIBUTES2, GI_UINTEGER },
{ SQL_STRING_FUNCTIONS, GI_UINTEGER },
{ SQL_SUBQUERIES, GI_UINTEGER },
{ SQL_SYSTEM_FUNCTIONS, GI_UINTEGER },
{ SQL_TABLE_TERM, GI_STRING },
{ SQL_TIMEDATE_ADD_INTERVALS, GI_UINTEGER },
{ SQL_TIMEDATE_DIFF_INTERVALS, GI_UINTEGER },
{ SQL_TIMEDATE_FUNCTIONS, GI_UINTEGER },
{ SQL_TXN_CAPABLE, GI_USMALLINT },
{ SQL_TXN_ISOLATION_OPTION, GI_UINTEGER },
{ SQL_UNION, GI_UINTEGER },
{ SQL_USER_NAME, GI_STRING },
{ SQL_XOPEN_CLI_YEAR, GI_STRING },
};
static PyObject*
Connection_getinfo(PyObject* self, PyObject* args)
{
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
unsigned long infotype;
if (!PyArg_ParseTuple(args, "k", &infotype))
return 0;
unsigned int i = 0;
for (; i < _countof(aInfoTypes); i++)
{
if (aInfoTypes[i].infotype == infotype)
break;
}
if (i == _countof(aInfoTypes))
return RaiseErrorV(0, ProgrammingError, "Invalid getinfo value: %d", infotype);
char szBuffer[0x1000];
SQLSMALLINT cch = 0;
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLGetInfo(cnxn->hdbc, (SQLUSMALLINT)infotype, szBuffer, sizeof(szBuffer), &cch);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle("SQLGetInfo", cnxn->hdbc, SQL_NULL_HANDLE);
return 0;
}
PyObject* result = 0;
switch (aInfoTypes[i].datatype)
{
case GI_YESNO:
result = (szBuffer[0] == 'Y') ? Py_True : Py_False;
Py_INCREF(result);
break;
case GI_STRING:
result = PyString_FromStringAndSize(szBuffer, (Py_ssize_t)cch);
break;
case GI_UINTEGER:
{
SQLUINTEGER n = *(SQLUINTEGER*)szBuffer; // Does this work on PPC or do we need a union?
if (n <= (SQLUINTEGER)PyInt_GetMax())
result = PyInt_FromLong((long)n);
else
result = PyLong_FromUnsignedLong(n);
break;
}
case GI_USMALLINT:
result = PyInt_FromLong(*(SQLUSMALLINT*)szBuffer);
break;
}
return result;
}
static PyObject*
Connection_endtrans(PyObject* self, PyObject* args, SQLSMALLINT type)
{
UNUSED(args);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
TRACE("%s: cnxn=%p hdbc=%d\n", (type == SQL_COMMIT) ? "commit" : "rollback", cnxn, cnxn->hdbc);
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLEndTran(SQL_HANDLE_DBC, cnxn->hdbc, type);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle("SQLEndTran", cnxn->hdbc, SQL_NULL_HANDLE);
return 0;
}
Py_RETURN_NONE;
}
static PyObject*
Connection_commit(PyObject* self, PyObject* args)
{
return Connection_endtrans(self, args, SQL_COMMIT);
}
static PyObject*
Connection_rollback(PyObject* self, PyObject* args)
{
return Connection_endtrans(self, args, SQL_ROLLBACK);
}
static char cursor_doc[] =
"Return a new Cursor object using the connection.";
static char execute_doc[] =
"execute(sql, [params]) --> Cursor\n"
"\n"
"Create a new Cursor object, call its execute method, and return it. See\n"
"Cursor.execute for more details.\n"
"\n"
"This is a convenience method that is not part of the DB API. Since a new\n"
"Cursor is allocated by each call, this should not be used if more than one SQL\n"
"statement needs to be executed.";
static char commit_doc[] =
"Commit any pending transaction to the database.";
static char rollback_doc[] =
"Causes the the database to roll back to the start of any pending transaction.";
static char getinfo_doc[] =
"getinfo(type) --> str | int | bool\n"
"\n"
"Calls SQLGetInfo, passing `type`, and returns the result formatted as a Python object.";
PyObject*
Connection_getautocommit(PyObject* self, void* closure)
{
UNUSED(closure);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
PyObject* result = (cnxn->nAutoCommit == SQL_AUTOCOMMIT_ON) ? Py_True : Py_False;
Py_INCREF(result);
return result;
}
static int
Connection_setautocommit(PyObject* self, PyObject* value, void* closure)
{
UNUSED(closure);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return -1;
if (value == 0)
{
PyErr_SetString(PyExc_TypeError, "Cannot delete the autocommit attribute.");
return -1;
}
SQLUINTEGER nAutoCommit = PyObject_IsTrue(value) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF;
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLSetConnectAttr(cnxn->hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)nAutoCommit, SQL_IS_UINTEGER);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle("SQLSetConnectAttr", cnxn->hdbc, SQL_NULL_HANDLE);
return -1;
}
cnxn->nAutoCommit = nAutoCommit;
return 0;
}
PyObject*
Connection_getsearchescape(Connection* self, void* closure)
{
UNUSED(closure);
if (!self->searchescape)
{
char sz[8] = { 0 };
SQLSMALLINT cch = 0;
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLGetInfo(self->hdbc, SQL_SEARCH_PATTERN_ESCAPE, &sz, _countof(sz), &cch);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
return RaiseErrorFromHandle("SQLGetInfo", self->hdbc, SQL_NULL_HANDLE);
self->searchescape = PyString_FromStringAndSize(sz, (Py_ssize_t)cch);
}
Py_INCREF(self->searchescape);
return self->searchescape;
}
static PyObject*
Connection_gettimeout(PyObject* self, void* closure)
{
UNUSED(closure);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return 0;
return PyInt_FromLong(cnxn->timeout);
}
static int
Connection_settimeout(PyObject* self, PyObject* value, void* closure)
{
UNUSED(closure);
Connection* cnxn = Connection_Validate(self);
if (!cnxn)
return -1;
if (value == 0)
{
PyErr_SetString(PyExc_TypeError, "Cannot delete the timeout attribute.");
return -1;
}
int timeout = PyInt_AsLong(value);
if (timeout == -1 && PyErr_Occurred())
return -1;
if (timeout < 0)
{
PyErr_SetString(PyExc_ValueError, "Cannot set a negative timeout.");
return -1;
}
SQLRETURN ret;
Py_BEGIN_ALLOW_THREADS
ret = SQLSetConnectAttr(cnxn->hdbc, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)timeout, SQL_IS_UINTEGER);
Py_END_ALLOW_THREADS
if (!SQL_SUCCEEDED(ret))
{
RaiseErrorFromHandle("SQLSetConnectAttr", cnxn->hdbc, SQL_NULL_HANDLE);
return -1;
}
cnxn->timeout = timeout;
return 0;
}
static bool _add_converter(Connection* cnxn, SQLSMALLINT sqltype, PyObject* func)
{
if (cnxn->conv_count)
{
// If the sqltype is already registered, replace the old conversion function with the new.
for (int i = 0; i < cnxn->conv_count; i++)
{
if (cnxn->conv_types[i] == sqltype)
{
Py_XDECREF(cnxn->conv_funcs[i]);
cnxn->conv_funcs[i] = func;
Py_INCREF(func);
return true;
}
}
}
int oldcount = cnxn->conv_count;
SQLSMALLINT* oldtypes = cnxn->conv_types;
PyObject** oldfuncs = cnxn->conv_funcs;
int newcount = oldcount + 1;
SQLSMALLINT* newtypes = (SQLSMALLINT*)pyodbc_malloc(sizeof(SQLSMALLINT) * newcount);
PyObject** newfuncs = (PyObject**)pyodbc_malloc(sizeof(PyObject*) * newcount);
if (newtypes == 0 || newfuncs == 0)
{
if (newtypes)
pyodbc_free(newtypes);
if (newfuncs)
pyodbc_free(newfuncs);
PyErr_NoMemory();
return false;
}
newtypes[0] = sqltype;
newfuncs[0] = func;
Py_INCREF(func);
cnxn->conv_count = newcount;
cnxn->conv_types = newtypes;
cnxn->conv_funcs = newfuncs;
if (oldcount != 0)
{
// copy old items
memcpy(&newtypes[1], oldtypes, sizeof(int) * oldcount);
memcpy(&newfuncs[1], oldfuncs, sizeof(PyObject*) * oldcount);
pyodbc_free(oldtypes);
pyodbc_free(oldfuncs);
}
return true;
}
static char conv_add_doc[] =
"add_output_converter(sqltype, func) --> None\n"
"\n"
"Register an output converter function that will be called whenever a value with\n"
"the given SQL type is read from the database.\n"
"\n"
"sqltype\n"
" The integer SQL type value to convert, which can be one of the defined\n"
" standard constants (e.g. pyodbc.SQL_VARCHAR) or a database-specific value\n"
" (e.g. -151 for the SQL Server 2008 geometry data type).\n"
"\n"
"func\n"
" The converter function which will be called with a single parameter, the\n"
" value, and should return the converted value. If the value is NULL, the\n"
" parameter will be None. Otherwise it will be a Python string.";
static PyObject*
Connection_conv_add(Connection* cnxn, PyObject* args)
{
int sqltype;
PyObject* func;
if (!PyArg_ParseTuple(args, "iO", &sqltype, &func))
return 0;
if (!_add_converter(cnxn, (SQLSMALLINT)sqltype, func))
return 0;
Py_RETURN_NONE;
}
static char enter_doc[] = "__enter__() -> self.";
static PyObject* Connection_enter(PyObject* self)
{
Py_INCREF(self);
return self;
}
static char exit_doc[] = "__exit__(*excinfo) -> None. Closes the connection.";
static PyObject* Connection_exit(Connection* cnxn, PyObject* args)
{
Connection_clear(cnxn);
Py_RETURN_NONE;
}
static struct PyMethodDef Connection_methods[] =
{
{ "cursor", (PyCFunction)Connection_cursor, METH_NOARGS, cursor_doc },
{ "close", (PyCFunction)Connection_close, METH_NOARGS, close_doc },
{ "execute", (PyCFunction)Connection_execute, METH_VARARGS, execute_doc },
{ "commit", (PyCFunction)Connection_commit, METH_NOARGS, commit_doc },
{ "rollback", (PyCFunction)Connection_rollback, METH_NOARGS, rollback_doc },
{ "getinfo", (PyCFunction)Connection_getinfo, METH_VARARGS, getinfo_doc },
{ "add_output_converter", (PyCFunction)Connection_conv_add, METH_VARARGS, conv_add_doc },
{ "clear_output_converters", (PyCFunction)Connection_conv_clear, METH_NOARGS, conv_clear_doc },
{ "__enter__", (PyCFunction)Connection_enter, METH_NOARGS, enter_doc },
{ "__exit__", (PyCFunction)Connection_exit, METH_VARARGS, exit_doc },
{ 0, 0, 0, 0 }
};
static PyGetSetDef Connection_getseters[] = {
{ "searchescape", (getter)Connection_getsearchescape, 0,
"The ODBC search pattern escape character, as returned by\n"
"SQLGetInfo(SQL_SEARCH_PATTERN_ESCAPE). These are driver specific.", 0 },
{ "autocommit", Connection_getautocommit, Connection_setautocommit,
"Returns True if the connection is in autocommit mode; False otherwise.", 0 },
{ "timeout", Connection_gettimeout, Connection_settimeout,
"The timeout in seconds, zero means no timeout.", 0 },
{ 0 }
};
PyTypeObject ConnectionType =
{
PyObject_HEAD_INIT(0)
0, // ob_size
"pyodbc.Connection", // tp_name
sizeof(Connection), // tp_basicsize
0, // tp_itemsize
(destructor)Connection_dealloc, // destructor tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_compare
0, // tp_repr
0, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT, // tp_flags
connection_doc, // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
Connection_methods, // tp_methods
0, // tp_members
Connection_getseters, // tp_getset
0, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
0, // tp_init
0, // tp_alloc
0, // tp_new
0, // tp_free
0, // tp_is_gc
0, // tp_bases
0, // tp_mro
0, // tp_cache
0, // tp_subclasses
0, // tp_weaklist
};
| [
"arvindchari88@gmail.com"
] | arvindchari88@gmail.com |
503f79b1dbb450b8fb7708cff0685f3717c84d84 | 51c1c5e9b8489ef8afa029b162aaf4c8f8bda7fc | /easyanim/src/easyanim/frame/MainFrame.h | 98c020649ef9544ca18e3e0141389b65a6f6a1b2 | [
"MIT"
] | permissive | aimoonchen/easyeditor | 3e5c77f0173a40a802fd73d7b741c064095d83e6 | 9dabdbfb8ad7b00c992d997d6662752130d5a02d | refs/heads/master | 2021-04-26T23:06:27.016240 | 2018-02-12T02:28:50 | 2018-02-12T02:28:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,077 | h | #pragma once
#include <wx/wx.h>
#include "view/Utility.h"
class wxSplitterWindow;
namespace eanim
{
class MainFrame : public wxFrame
{
public:
MainFrame(const wxString& title);
private:
void onNew(wxCommandEvent& event);
void onOpen(wxCommandEvent& event);
void onSave(wxCommandEvent& event);
void onSaveAs(wxCommandEvent& event);
void onQuit(wxCommandEvent& event);
void onAbout(wxCommandEvent& event);
// void onSetLanguageCN(wxCommandEvent& event);
// void onSetLanguageEN(wxCommandEvent& event);
void onPreview(wxCommandEvent& event);
void initMenuBar();
wxMenu* initFileBar();
wxMenu* initViewBar();
wxMenu* initHelpBar();
void initWorkingFrame();
void clear();
void refresh();
void setCurrFilename();
private:
static const float SASH_GRAVITY_HOR;
static const float SASH_GRAVITY_VERT;
enum
{
Menu_LanguageSetting,
Menu_LanguageChinese,
Menu_LanguageEnglish,
Menu_Preview
};
static LanguageEntry entries[];
private:
std::string m_currFilename;
DECLARE_EVENT_TABLE()
}; // MainFrame
}
| [
"zhuguang@ejoy.com"
] | zhuguang@ejoy.com |
6c2ec5cb6a101229977a77f0305ab3ff8456e728 | 647d7796bc68f7da2ea96a7c90e6195a2abcf999 | /contractwidget/FunctionWidget.h | 76afcfd4a9820ad936507c8f0c2394f6d3af5be9 | [] | no_license | BlockLink/IDE-Qt | 4ede6b3c8c9d382b1d0b8d9d0effc55a94337cb6 | 53b250270d6e846a3a6b3fb2a6c8bae5cda2e2ab | refs/heads/master | 2020-03-20T09:28:35.401277 | 2018-07-11T05:25:56 | 2018-07-11T05:25:56 | 137,338,346 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 605 | h | #ifndef FUNCTIONWIDGET_H
#define FUNCTIONWIDGET_H
#include <QWidget>
namespace Ui {
class FunctionWidget;
}
class FunctionWidget : public QWidget
{
Q_OBJECT
public:
explicit FunctionWidget(QWidget *parent = 0);
~FunctionWidget();
signals:
public:
void RefreshContractAddr(const QString &addr);
public slots:
void retranslator();
private slots:
void jsonDataUpdated(const QString &id,const QString &data);
private:
void InitWidget();
bool parseContractInfo(const QString &addr, const QString &data);
private:
Ui::FunctionWidget *ui;
};
#endif // FUNCTIONWIDGET_H
| [
"47029316@qq.com"
] | 47029316@qq.com |
09281cf089dd7b5b4dc912abd432da65d888f6f2 | df0aa0dd7ffc0765d21fc076015b9830ef025fa0 | /lab1/01_potega.cpp | 80dd83e58f8a202e94f0c86bfdb75714ac0c6a2b | [
"MIT"
] | permissive | Machina123/OOProgramming | 0b8fe74716d3efd577bbdac3edb50469f3c17afa | 419a33f6eb5ca93bdddd44ac6381c69252b76d20 | refs/heads/master | 2020-03-31T21:06:34.118233 | 2018-11-21T18:58:41 | 2018-11-21T18:58:41 | 152,567,867 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 348 | cpp | #include <iostream>
void potega(float *);
void potega_ref(float &);
int main() {
float x = 5.0f;
potega(&x);
std::cout << "x=" << x << std::endl;
x = 5.0f;
potega_ref(x);
std::cout << "x=" << x << std::endl;
return 0;
}
void potega(float * x) {
*x = (*x) * (*x) * (*x) * (*x);
}
void potega_ref(float & x) {
x = (x * x * x * x);
} | [
"machina123@boun.cr"
] | machina123@boun.cr |
900e24bfc398db3c7882b72501abba172954dafa | 1787588a5ebcaa184f2a067903a653a245d03e9d | /arc002/a/main.cpp | ba4ea0f2cbddcfa4605e56d1d1517580764c62e4 | [] | no_license | ebisenttt/atcoder | a3576658eac148372561a6838c081952744f4dee | edfb13c4eb240f5650651cd66fd925496f678257 | refs/heads/main | 2023-06-17T22:54:20.138588 | 2021-07-16T07:43:03 | 2021-07-16T07:43:03 | 313,921,901 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 612 | cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1e9
typedef long long ll;
typedef long double ld;
int main(){
ll y;
cin>>y;
bool is;
if(y%4==0){
if(y%100==0){
if(y%400==0){
is=true;
}else{
is=false;
}
}else{
is=true;
}
}else{
is=false;
}
string ans=is?"YES":"NO";
cout<<ans<<endl;
return 0;
}
| [
"vamos.nippon.2010@gmail.com"
] | vamos.nippon.2010@gmail.com |
d875b95421e6d0af40db253e02e54797979afd95 | d137db9815e985f611ce2870d98cfc96aa89cd00 | /Taiga 4 Engine/logic_particle.cpp | ef5e6492fe0ae086a6d05148539140894fea3687 | [] | no_license | Tenebrie/Taiga-4-Engine | 0df9052196be4b7346154242902f2e3b837cb6f4 | 32fc7e3e452af9cb5e50f21d35d0413fcac1d4e1 | refs/heads/master | 2021-05-31T13:22:51.190694 | 2016-04-03T17:58:08 | 2016-04-03T17:58:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,984 | cpp |
#include "main.h"
#include "logic.h"
#include "game.h"
#include "camera.h"
#include "weather.h"
#include "math.h"
#include "particle.h"
#include "settings.h"
float cloudTimer = 0.00f;
float weatherTimer = 0.00f;
float particleTimer = 0.00f;
void cGameLogic::updateParticles(int elapsedTime)
{
int id;
float randVal;
vec2f bufferArea = vec2f(1000.00f, 1000.00f), cloudPos, cloudSizeVec;
float timevar = (float)elapsedTime / 1000;
timevar *= core.timeModifier;
sf::FloatRect camRect(camera.pos.x, camera.pos.y, camera.res.x, camera.res.y);
sf::FloatRect cloudRect;
// Updating global weather data
// Determine the new values
weatherTimer += timevar;
if (weatherTimer > 15.00f)
{
weatherTimer = 0.00f;
// Only change weather on server side
if (core.serverSide() && math.randf(0.00f, 1.00f) < 0.15f)
{
randVal = math.randf(0.00f, 1.00f);
// Sunny ( 10% )
if (randVal <= 0.10f) {
//console.debug << "[DEBUG] Weather: Sunny" << endl;
weather.changeTo(WEATHER_SNOW, 0.00f);
weather.changeWindTo(0.00f);
weather.changeCloudsTo(math.randf(500.00f, 2500.00f));
}
// Light snow ( 15% )
else if (randVal <= 0.25f) {
//console.debug << "[DEBUG] Weather: Light snow" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(2500.00f, 7500.00f));
weather.changeWindTo(math.randf(0.00f, 3000.00f));
weather.changeCloudsTo(math.randf(2500.00f, 10000.00f));
}
// Tons of snow ( 15% )
else if (randVal <= 0.40f) {
//console.debug << "[DEBUG] Weather: Tons of snow" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(15000.00, 25000.00f));
weather.changeWindTo(math.randf(0.00f, 3000.00f));
weather.changeCloudsTo(math.randf(30000.00f, 50000.00f));
}
// Really windy ( 10% )
else if (randVal <= 0.50f) {
//console.debug << "[DEBUG] Weather: Really windy" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(0.00f, 5000.00f));
weather.changeWindTo(math.randf(15000.00f, 20000.00f));
weather.changeCloudsTo(math.randf(500.00f, 10000.00f));
}
// Clouds everywhere ( 20% )
else if (randVal <= 0.70f) {
//console.debug << "[DEBUG] Weather: Clouds everywhere" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(0.00f, 1000.00f));
weather.changeWindTo(math.randf(0.00f, 5000.00f));
weather.changeCloudsTo(math.randf(30000.00f, 50000.00f));
}
// Blizzard ( 5% )
else if (randVal <= 0.75f) {
//console.debug << "[DEBUG] Weather: Blizzard" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(15000.00f, 25000.00f));
weather.changeWindTo(math.randf(15000.00f, 20000.00f));
weather.changeCloudsTo(math.randf(30000.00f, 50000.00f));
}
// Everything medium ( 15% )
else if (randVal <= 0.90f) {
//console.debug << "[DEBUG] Weather: Everything medium" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(7500.00f, 15000.00f));
weather.changeWindTo(math.randf(5000.00f, 15000.00f));
weather.changeCloudsTo(math.randf(15000.00f, 25000.00f));
}
// Completely random ( 10% )
else {
//console.debug << "[DEBUG] Weather: Random" << endl;
weather.changeTo(WEATHER_SNOW, math.randf(0.00f, 25000.00f));
weather.changeWindTo(math.randf(0.00f, 20000.00f));
weather.changeCloudsTo(math.randf(500.00f, 50000.00f));
}
}
}
// Updating current values
float snowPowerMod = 250.00f;
float windPowerMod = 300.00f;
float cloudPowerMod = 750.00f;
// Snow power
if (weather.power[WEATHER_SNOW] < weather.targetPower[WEATHER_SNOW]) {
weather.power[WEATHER_SNOW] += snowPowerMod * timevar;
if (weather.power[WEATHER_SNOW] > weather.targetPower[WEATHER_SNOW]) { weather.power[WEATHER_SNOW] = weather.targetPower[WEATHER_SNOW]; }
}
else if (weather.power[WEATHER_SNOW] > weather.targetPower[WEATHER_SNOW]) {
weather.power[WEATHER_SNOW] -= snowPowerMod * timevar;
if (weather.power[WEATHER_SNOW] < weather.targetPower[WEATHER_SNOW]) { weather.power[WEATHER_SNOW] = weather.targetPower[WEATHER_SNOW]; }
}
// Wind power
if (weather.windPower < weather.targetWind) {
weather.windPower += windPowerMod * timevar;
if (weather.windPower > weather.targetWind) { weather.windPower = weather.targetWind; }
}
else if (weather.windPower > weather.targetWind) {
weather.windPower -= windPowerMod * timevar;
if (weather.windPower < weather.targetWind) { weather.windPower = weather.targetWind; }
}
// Cloud power
if (weather.cloudDensity < weather.targetCloud) {
weather.cloudDensity += cloudPowerMod * timevar;
if (weather.cloudDensity > weather.targetCloud) { weather.cloudDensity = weather.targetCloud; }
}
else if (weather.cloudDensity > weather.targetCloud) {
weather.cloudDensity -= cloudPowerMod * timevar;
if (weather.cloudDensity < weather.targetCloud) { weather.cloudDensity = weather.targetCloud; }
}
// Spawning clouds
cloudTimer += timevar;
if (weather.cloudDensity > 0.00f)
{
int cloudCount = (int)weather.cloud.size();
int targetCount = weather.cloudDensity * settings.cloudDensity / 100.00f;
while (cloudCount < targetCount)
{
cloudCount = (int)weather.cloud.size();
cloudTimer = 0.00f;
if (cloudCount < targetCount)
{
int saver = 0;
float cloudSize = math.randf(300.00f, 500.00f);
do
{
//cloudPos.x = camera.pos.x + camera.res.x + cloudSize;
//cloudPos.y = camera.pos.y + math.randf(0.00f, camera.res.y);
cloudPos.x = math.randf(camera.pos.x - bufferArea.x, camera.pos.x + camera.res.x + bufferArea.x);
cloudPos.y = math.randf(camera.pos.y - bufferArea.y, camera.pos.y + camera.res.y + bufferArea.y);
cloudSizeVec.x = cloudSize;
cloudSizeVec.y = cloudSize;
cloudRect = sf::FloatRect(cloudPos - cloudSizeVec / 2.00f, cloudSizeVec);
saver += 1;
} while (cloudRect.intersects(camRect) && saver < 200);
if (saver < 200) { weather.createCloud(cloudPos, cloudSizeVec); }
}
}
}
// Updating the cloud data
cWeatherCloud* cloud;
float moveMod = timevar * max(0.20f, weather.windPower / 10000.00f);
mutex.renderClouds.lock();
for (int i = 0; i < (int)weather.cloud.size(); i++)
{
cloud = &weather.cloud[i];
cloud->pos += cloud->moveVector * moveMod;
if (weather.cloud[i].pos.x < camera.pos.x - bufferArea.x) { weather.removeCloud(i); }
else if (weather.cloud[i].pos.x > camera.pos.x + camera.res.x + bufferArea.x) { weather.removeCloud(i); }
else if (weather.cloud[i].pos.y < camera.pos.y - bufferArea.y) { weather.removeCloud(i); }
else if (weather.cloud[i].pos.y > camera.pos.y + camera.res.y + bufferArea.y) { weather.removeCloud(i); }
}
mutex.renderClouds.unlock();
// Spawning snow
particleTimer += timevar;
mutex.renderParticles.lock();
if (particleTimer >= 0.05f)
{
particleTimer = 0;
if (weather.power[WEATHER_SNOW] > 0.00f)
{
int count = math.round(weather.power[WEATHER_SNOW] * settings.particleDensity / 1000.00f);
for (int i = 0; i < math.rand(max(0, count - 5), count); i++)
{
vec2f spawnPoint = vec2f(camera.pos.x + math.randf(0.00, camera.res.x), camera.pos.y + math.randf(0.00f, camera.res.y));
id = particle.addUnit("weather_snow", spawnPoint, math.randf(265.00f, 275.00f) + (weather.windPower / 10000.00f) * 30.00f, math.randf(1.00f, 2.00f), 45.00f);
particle.unit[id].movementSpeed = math.rand(50, 100) * max(1.00f, weather.windPower / 2500.00f);
particle.unit[id].updateGenData();
particle.unit[id].setFade(FADE_IN, 0.50f);
}
}
}
// Updating the particle data
float shadowAngleMod = 4.00f;
float shadowScaleMod = 1.00f;
float shadowScaleMin = 1.20f;
float shadowAngle = 0.00f, shadowScale = 1.20f;
float timeLocal = game.timeOfDay;
shadowScale = abs(timeLocal - 12.00f) / 6.00f * shadowScaleMod + shadowScaleMin;
shadowAngle = (timeLocal - 12.00f) * shadowAngleMod;
cParticleUnit* unit;
for (int i = 0; i < (int)particle.unit.size(); i++)
{
unit = &particle.unit[i];
unit->pos -= unit->moveVector * timevar;
// Always on screen
if (unit->hasRef(REF_PARTICLE_ONSCREEN))
{
if (unit->pos.x < camera.pos.x) { unit->pos.x += camera.res.x; }
else if (unit->pos.x > camera.pos.x + camera.res.x) { unit->pos.x -= camera.res.x; }
else if (unit->pos.y < camera.pos.y) { unit->pos.y += camera.res.y; }
else if (unit->pos.y > camera.pos.y + camera.res.y) { unit->pos.y -= camera.res.y; }
}
unit->updateShadowPos(shadowAngle, shadowScale);
// Life timer
if (unit->fadeType != FADE_OUT)
{
unit->lifetime -= timevar;
if (unit->lifetime <= 0.00f) {
unit->moveVector = vec2f(0.00f, 0.00f);
unit->lifetime = 0.00f;
unit->setFade(FADE_OUT, 0.50f);
}
}
// Fade
if (unit->fadeType != FADE_STOP)
{
if (unit->fadeType == FADE_IN) {
unit->fadeVal += timevar;
if (unit->fadeVal >= unit->fadeMax) { unit->setFade(FADE_STOP, 1.00f); }
}
else if (unit->fadeType == FADE_OUT) {
unit->fadeVal -= timevar;
if (unit->fadeVal <= 0.00f) {
particle.removeUnit(i);
i -= 1;
}
}
}
}
mutex.renderParticles.unlock();
} | [
"kos94ok@gmail.com"
] | kos94ok@gmail.com |
145d51f4422bf41942bc9276a87c4ccbf967a9de | 3dae113e380c6773822b8d01d10001a3ecd7aaea | /mayaplugin/src/utils.cpp | 4aab65e7bba2cd4f323518f7afa7c1698ae1c4d5 | [] | no_license | sbarthelemy/libalmath | dd13cee4b612bea12cce8c1c35ccf3e643f7ccbe | b96f82297033cb3f71d2c4858fae279c3d7ed758 | refs/heads/master | 2020-06-24T00:39:24.142037 | 2017-09-21T14:32:04 | 2018-02-22T10:10:57 | 96,911,726 | 0 | 0 | null | 2017-07-11T16:01:27 | 2017-07-11T16:01:27 | null | UTF-8 | C++ | false | false | 14,926 | cpp | #include "utils.h"
#include <maya/MFileIO.h>
#include <maya/MGlobal.h>
#include <maya/MNamespace.h>
#include <maya/MItDag.h>
#include <maya/MPointArray.h>
#include <maya/MDoubleArray.h>
#include <maya/MFnNurbsCurve.h>
#include <fstream>
namespace SBRMP {
// Doc about MString and encoding
// http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files_GUID_258601E3_3783_4709_8DD7_916BD60FD918_htm
std::fstream create_fstream(const MString &filename,
std::ios_base::openmode mode) {
// Note: maybe on Visual Studio we should instead do
// return std::fstream(filename.asWChar(), mode)
return std::fstream(filename.asChar(), mode);
}
std::ifstream create_ifstream(const MString &filename,
std::ios_base::openmode mode) {
// Note: maybe on Visual Studio we should instead do
// return std::fstream(filename.asWChar(), mode)
return std::ifstream(filename.asChar(), mode);
}
std::ofstream create_ofstream(const MString &filename,
std::ios_base::openmode mode) {
// Note: maybe on Visual Studio we should instead do
// return std::ofstream(filename.asWChar(), mode)
return std::ofstream(filename.asChar(), mode);
}
MTime::Unit unitFromFps(int fps) {
switch (fps)
{
case 2:
return MTime::Unit::k2FPS;
case 3:
return MTime::Unit::k3FPS;
case 4:
return MTime::Unit::k4FPS;
case 5:
return MTime::Unit::k5FPS;
case 6:
return MTime::Unit::k6FPS;
case 8:
return MTime::Unit::k8FPS;
case 10:
return MTime::Unit::k10FPS;
case 12:
return MTime::Unit::k12FPS;
case 15:
return MTime::Unit::kGames;
case 16:
return MTime::Unit::k16FPS;
case 20:
return MTime::Unit::k20FPS;
case 24:
return MTime::Unit::kFilm;
case 25:
return MTime::Unit::kPALFrame;
case 30:
return MTime::Unit::kNTSCFrame;
case 40:
return MTime::Unit::k40FPS;
case 48:
return MTime::Unit::kShowScan;
case 50:
return MTime::Unit::kPALField;
case 60:
return MTime::Unit::kNTSCField;
case 75:
return MTime::Unit::k75FPS;
case 80:
return MTime::Unit::k80FPS;
case 100:
return MTime::Unit::k100FPS;
case 120:
return MTime::Unit::k120FPS;
case 125:
return MTime::Unit::k125FPS;
case 150:
return MTime::Unit::k150FPS;
case 200:
return MTime::Unit::k200FPS;
case 240:
return MTime::Unit::k240FPS;
case 250:
return MTime::Unit::k250FPS;
case 300:
return MTime::Unit::k300FPS;
case 375:
return MTime::Unit::k375FPS;
case 400:
return MTime::Unit::k400FPS;
case 500:
return MTime::Unit::k500FPS;
case 600:
return MTime::Unit::k600FPS;
case 750:
return MTime::Unit::k750FPS;
case 1200:
return MTime::Unit::k1200FPS;
case 1500:
return MTime::Unit::k1500FPS;
case 2000:
return MTime::Unit::k2000FPS;
case 3000:
return MTime::Unit::k3000FPS;
case 6000:
return MTime::Unit::k6000FPS;
}
std::stringstream msg;
msg << "no MTime::Unit can represent " << fps << " frames per second.";
throw(std::invalid_argument(msg.str()));
}
int fpsFromUnit(MTime::Unit unit) {
switch (unit)
{
case MTime::Unit::k2FPS:
return 2;
case MTime::Unit::k3FPS:
return 3;
case MTime::Unit::k4FPS:
return 4;
case MTime::Unit::k5FPS:
return 5;
case MTime::Unit::k6FPS:
return 6;
case MTime::Unit::k8FPS:
return 8;
case MTime::Unit::k10FPS:
return 10;
case MTime::Unit::k12FPS:
return 12;
case MTime::Unit::kGames:
return 15;
case MTime::Unit::k16FPS:
return 16;
case MTime::Unit::k20FPS:
return 20;
case MTime::Unit::kFilm:
return 24;
case MTime::Unit::kPALFrame:
return 25;
case MTime::Unit::kNTSCFrame:
return 30;
case MTime::Unit::k40FPS:
return 40;
case MTime::Unit::kShowScan:
return 48;
case MTime::Unit::kPALField:
return 50;
case MTime::Unit::kNTSCField:
return 60;
case MTime::Unit::k75FPS:
return 75;
case MTime::Unit::k80FPS:
return 80;
case MTime::Unit::k100FPS:
return 100;
case MTime::Unit::k120FPS:
return 120;
case MTime::Unit::k125FPS:
return 125;
case MTime::Unit::k150FPS:
return 150;
case MTime::Unit::k200FPS:
return 200;
case MTime::Unit::k240FPS:
return 240;
case MTime::Unit::k250FPS:
return 250;
case MTime::Unit::k300FPS:
return 300;
case MTime::Unit::k375FPS:
return 375;
case MTime::Unit::k400FPS:
return 400;
case MTime::Unit::k500FPS:
return 500;
case MTime::Unit::k600FPS:
return 600;
case MTime::Unit::k750FPS:
return 750;
case MTime::Unit::k1200FPS:
return 1200;
case MTime::Unit::k1500FPS:
return 1500;
case MTime::Unit::k2000FPS:
return 2000;
case MTime::Unit::k3000FPS:
return 3000;
case MTime::Unit::k6000FPS:
return 6000;
case MTime::Unit::kInvalid:
case MTime::Unit::kUserDef:
case MTime::Unit::kLast:
case MTime::Unit::kHours:
case MTime::Unit::kMinutes:
break;
}
throw std::invalid_argument(
"this MTime::Unit cannot be represented as an integer number of frames"
" per second");
}
std::pair<MFnTransform::LimitType, MFnTransform::LimitType>
toMayaTransformLimitsType(ScrewAxis axis) {
using R = std::pair<MFnTransform::LimitType, MFnTransform::LimitType>;
switch (axis) {
case ScrewAxis::rx:
return R(MFnTransform::kRotateMinX, MFnTransform::kRotateMaxX);
case ScrewAxis::ry:
return R(MFnTransform::kRotateMinY, MFnTransform::kRotateMaxY);
case ScrewAxis::rz:
return R(MFnTransform::kRotateMinZ, MFnTransform::kRotateMaxZ);
case ScrewAxis::tx:
return R(MFnTransform::kTranslateMinX, MFnTransform::kTranslateMaxX);
case ScrewAxis::ty:
return R(MFnTransform::kTranslateMinY, MFnTransform::kTranslateMaxY);
case ScrewAxis::tz:
return R(MFnTransform::kTranslateMinZ, MFnTransform::kTranslateMaxZ);
}
throw std::invalid_argument("input matched no MFnTransform::LimitType pair");
}
MString toMayaTransformAttrName(ScrewAxis axis) {
switch (axis) {
case ScrewAxis::rx:
return "rx";
case ScrewAxis::ry:
return "ry";
case ScrewAxis::rz:
return "rz";
case ScrewAxis::tx:
return "tx";
case ScrewAxis::ty:
return "ty";
case ScrewAxis::tz:
return "tz";
}
throw std::invalid_argument("input matched no MFnTransform attribute");
}
ScrewAxis screwAxisFromMayaTransformAttrName(MString name) {
if (name == "rx")
return ScrewAxis::rx;
if (name == "ry")
return ScrewAxis::ry;
if (name == "rz")
return ScrewAxis::rz;
if (name == "tx")
return ScrewAxis::tx;
if (name == "ty")
return ScrewAxis::ty;
if (name == "tz")
return ScrewAxis::tz;
throw std::invalid_argument("input matched no ScrewAxis");
}
MStatus lockTransformPlugs(MFnTransform &transformFn) {
if (transformFn.object().isNull()) {
return MStatus::kFailure;
}
MStatus status;
const auto isFree = false;
for (auto attrName : {
"rx", "ry", "rz", // rotate
"tx", "ty", "tz", // translate
"sx", "sy", "sz", // scale
"rax", "ray", "raz", // rotate axis
"shearXY", "shearXZ", "shearYZ" }) {
auto plug = transformFn.findPlug(attrName, false, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = plug.setKeyable(isFree);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = plug.setLocked(!isFree);
CHECK_MSTATUS_AND_RETURN_IT(status);
}
return status;
}
MStatus lockIkJointPlugs(MFnIkJoint &ikJointFn) {
if (ikJointFn.object().isNull()) {
return MStatus::kFailure;
}
MStatus status = lockTransformPlugs(ikJointFn);
CHECK_MSTATUS_AND_RETURN_IT(status);
const auto isFree = false;
for (auto attrName : { "jointOrientX", "jointOrientY", "jointOrientZ" }) {
auto plug = ikJointFn.findPlug(attrName, false, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = plug.setKeyable(isFree);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = plug.setLocked(!isFree);
CHECK_MSTATUS_AND_RETURN_IT(status);
}
return status;
}
MStatus unlockTransformPlug(MFnTransform &transformFn, ScrewAxis dof) {
MStatus status;
const auto attrName = toMayaTransformAttrName(dof);
auto plug = transformFn.findPlug(attrName, false, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = plug.setKeyable(true);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = plug.setLocked(false);
CHECK_MSTATUS_AND_RETURN_IT(status);
return status;
}
std::vector<MPlug> getIkJointAnimatablePlugs(const MObject &ikJointObj) {
MStatus status;
std::vector<MPlug> plugs;
MFnDependencyNode ikJointFn(ikJointObj);
for (auto attrName : {
"rx", "ry", "rz", // rotate
"tx", "ty", "tz" }) { // translate
MPlug plug = ikJointFn.findPlug(attrName, false, &status);
if (status != MStatus::kSuccess)
continue;
bool isKeyable = plug.isKeyable(&status);
if ((status == MStatus::kSuccess) && isKeyable)
plugs.push_back(plug);
}
return plugs;
}
MStatus setLimits(MFnIkJoint &ikJointFn, ScrewAxis axis,
const std::pair<double, double> &limits) {
const auto limitsId = toMayaTransformLimitsType(axis);
MStatus status;
status = ikJointFn.setLimit(limitsId.first, limits.first);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = ikJointFn.enableLimit(limitsId.first, true);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = ikJointFn.setLimit(limitsId.second, limits.second);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = ikJointFn.enableLimit(limitsId.second, true);
CHECK_MSTATUS_AND_RETURN_IT(status);
return status;
}
ScopedCurrentNamespace::ScopedCurrentNamespace(const MString &newNamespace) {
if (newNamespace.length() == 0u)
return;
MStatus status;
previousNamespace = MNamespace::currentNamespace(&status);
// Create the namespace.
// Will fail if the namespace already exists.
// Note that we cannot use
// MNamespace::namespaceExists(newNamespace, &status);
// because it does not account for relative namespaces.
status = MNamespace::addNamespace(newNamespace);
//CHECK_MSTATUS(status);
status = MNamespace::setCurrentNamespace(newNamespace);
CHECK_MSTATUS(status);
}
ScopedCurrentNamespace::~ScopedCurrentNamespace() {
if (previousNamespace.length() == 0u)
return;
auto status = MNamespace::setCurrentNamespace(previousNamespace);
CHECK_MSTATUS(status);
}
MStatus importColladaMesh(MString filename, MString groupname,
MObject &object) {
MStatus status;
if (false) {
MFileIO fileio;
// TODO: visual_namespace argument is ignored
// see http://forums.autodesk.com/t5/maya-programming/importing-a-collada-mesh-from-c-an-alternative-to-mfileio/m-p/6830714
MString nnamespace("_visual");
status = fileio.importFile(filename, "DAE_FBX", false, nnamespace.asChar());
CHECK_MSTATUS_AND_RETURN_IT(status);
}
else {
// first import the file as children of world.
// Since we use the -groupName options, they will be ancestors of
// one pkTranskorm node
//
// beware, this part is vulnerable to MEL injection
auto cmd = MString("file -returnNewNodes -groupReference -groupName \"") +
groupname + "\" -import -type \"DAE_FBX\" \""
+ filename + "\";";
MStringArray names;
status = MGlobal::executeCommand(cmd, names);
CHECK_MSTATUS_AND_RETURN_IT(status);
// Iterate over the world kTransform children, in order to find the
// "-groupName" one. We compare with `names`
// instead of `groupname` in case maya changed it (namespacing or so).
// Since we iterate breadth-first, we'll find the good one.
MItDag dagIter(MItDag::kBreadthFirst, MFn::kTransform);
while (!dagIter.isDone() && object.isNull()) {
auto fullPathName = dagIter.fullPathName(&status);
CHECK_MSTATUS_AND_RETURN_IT(status);
for (auto i = 0u; i < names.length(); ++i) {
if (names[i] == fullPathName) {
object = dagIter.currentItem(&status);
CHECK_MSTATUS_AND_RETURN_IT(status);
break;
}
}
dagIter.next();
}
if (object.isNull()) {
std::cerr << "failed to find the node imported from \""
<< filename << "\"";
return MStatus::kFailure;
}
}
return status;
}
std::multimap<std::string, MPlug> getIkJointsAnimatablePlugsMap(
const MObject root) {
std::multimap<std::string, MPlug> ret;
MStatus status;
MItDag dagIter(MItDag::kDepthFirst, MFn::kJoint);
if (root != MObject::kNullObj) {
status = dagIter.reset(root, MItDag::kDepthFirst, MFn::kJoint);
CHECK_MSTATUS_AND_THROW_IT(status);
}
MFnIkJoint ikJointFn;
while (!dagIter.isDone()) {
ikJointFn.setObject(dagIter.currentItem());
for (const auto &p : getIkJointAnimatablePlugs(dagIter.currentItem())) {
ret.emplace(ikJointFn.name().asChar(), p);
}
dagIter.next();
}
return ret;
}
MTime maxAnimCurveTime(const PlugsMap &plugsMap) {
MTime res(0.);
MStatus status;
for (const auto &kv : plugsMap) {
const auto& plug = kv.second;
if (plug.isNull() || !plug.isConnected())
continue;
MFnAnimCurve animCurveFn(plug, &status);
CHECK_MSTATUS_AND_THROW_IT(status);
auto k = animCurveFn.numKeys();
if (k > 0u)
res = std::max(res, animCurveFn.time(k - 1u));
}
return res;
}
MObject addNurbsCircle(Axis normalAxis, double radius, MObject parent) {
MStatus status = MStatus::kFailure;
MFnNurbsCurve circleFn;
const int ncvs = 50;
const int nknots = (ncvs - 3) + 2 * 3 - 1;
MDoubleArray knotSequences;
MPointArray controlVerticles;
MPoint p;
for (auto i = 0; i < ncvs; i++) {
switch (normalAxis)
{
case Axis::x:
p.x = 0;
p.y = radius * sin((double)(i) / boost::math::constants::pi<double>());
p.z = radius * cos((double)(i) / boost::math::constants::pi<double>());
case Axis::y:
p.x = radius * sin((double)(i) / boost::math::constants::pi<double>());
p.y = 0;
p.z = radius * cos((double)(i) / boost::math::constants::pi<double>());
case Axis::z:
p.x = radius * sin((double)(i) / boost::math::constants::pi<double>());
p.y = radius * cos((double)(i) / boost::math::constants::pi<double>());
p.z = 0;
}
controlVerticles.append(MPoint(p));
}
for (auto i = 0; i < nknots; i++)
knotSequences.append((double)i);
MObject circle = circleFn.create(controlVerticles, knotSequences,
3, MFnNurbsCurve::kOpen,
false, false, parent, &status);
CHECK_MSTATUS_AND_THROW_IT(status);
return circle;
}
void addControllers(const PlugsMap &plugsMap, double radius) {
for (auto it = plugsMap.begin(); it != plugsMap.end(); it++) {
ScrewAxis sa = screwAxisFromMayaTransformAttrName(it->second.partialName());
Axis axis = toAxis(sa);
MObject transformObj = it->second.node();
addNurbsCircle(axis, radius, transformObj);
}
}
} | [
"sbarthelemy@aldebaran-robotics.com"
] | sbarthelemy@aldebaran-robotics.com |
8ddb86ab6fea083c3f6d89d8bfdc49068e1d1396 | ed804a29ed92bfa9b0195e16649842e860b56cb4 | /TensorEngine/TensorEngine/TensorNode.h | 2b3b82ee5c19a174a187f427df45e3af63e28f43 | [] | no_license | xiaoyaolanyun/QuantumTensorEngine | b5e3180c8d85305654783cab732ed1923cd30282 | c6081b3f2a8a4e6cd541613f921f4b1a4a8ae035 | refs/heads/master | 2020-04-07T13:24:31.790451 | 2018-11-20T15:05:57 | 2018-11-20T15:05:57 | 158,406,298 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,466 | h | #ifndef TENSOR_NODE_H
#define TENSOR_NODE_H
#include <complex>
#include <vector>
#include <map>
#include <exception>
using std::map;
using std::complex;
using std::vector;
using std::exception;
using std::pair;
typedef double qdata_t;
typedef size_t qsize_t;
typedef size_t qsize_t;
typedef complex<qdata_t> qcomplex_data_t;
typedef vector<qcomplex_data_t> qstate_t;
typedef vector<pair<qsize_t, qsize_t>> qubit_vector_t;
class Edge;
typedef map<size_t, Edge> EdgeMap;
class ComplexTensor
{
public:
ComplexTensor();
~ComplexTensor();
friend class ComplexTensor;
int getRank() const;
qcomplex_data_t getElem(size_t num);
friend ComplexTensor matrixMultiplication(const ComplexTensor &matrix_left,
const ComplexTensor &matrix_right);
void dimIncrement() ;
void getSubTensor(size_t num,int value);
void dimDecrement(size_t num) ;
void swap(qsize_t, qsize_t);
ComplexTensor & operator * (ComplexTensor &);
ComplexTensor operator + (ComplexTensor &);
ComplexTensor& operator = (ComplexTensor &);
ComplexTensor(const ComplexTensor& old)
:m_rank(old.m_rank),
m_tensor(old.m_tensor)
{
}
ComplexTensor(int rank,qstate_t tensor)
:m_rank(rank),
m_tensor(tensor)
{
}
private:
int m_rank;
qstate_t m_tensor;
};
inline ComplexTensor::ComplexTensor():m_rank(0)
{
}
inline ComplexTensor::~ComplexTensor()
{
}
class VerticeMatrix;
class QuantumProgMap;
class Edge
{
public:
friend class Edge;
inline Edge(qsize_t qubit_count,
ComplexTensor &tensor,
vector<pair<qsize_t, qsize_t>> &contect_vertice) noexcept :
m_tensor(tensor),
m_contect_vertice(contect_vertice),
m_qubit_count(qubit_count)
{
}
~Edge() {};
inline Edge(const Edge & old) :
m_tensor(old.getComplexTensor()),
m_qubit_count(old.m_qubit_count),
m_contect_vertice(old.m_contect_vertice)
{
}
void earseContectVertice(qsize_t qubit, size_t num);
qsize_t getQubitCount()const noexcept;
void premultiplication(Edge &);
bool mergeEdge(Edge & );
void dimDecrementbyValue(qsize_t ,qsize_t,
int value);
void dimDecrement(qsize_t qubit, qsize_t num);
void dimIncrementByEdge(Edge &);
void swapByEdge(Edge &);
int getRank() const noexcept;
ComplexTensor getComplexTensor() const noexcept;
qcomplex_data_t getElem(VerticeMatrix &vertice);
void setComplexTensor( ComplexTensor &) noexcept;
vector<pair<qsize_t, qsize_t>> getContectVertice() const noexcept;
void setContectVerticeVector(const qubit_vector_t &) noexcept;
void setContectVertice(qsize_t qubit, qsize_t src_num, qsize_t des_num);
private:
qsize_t m_qubit_count;
ComplexTensor m_tensor;
qubit_vector_t m_contect_vertice;
};
class Vertice
{
public:
inline Vertice(int value, vector<qsize_t> &contect_edge) noexcept
:m_contect_edge(contect_edge), m_value(value)
{}
inline Vertice() : m_value(-1)
{}
~Vertice()
{
}
inline Vertice operator = (const Vertice & old)
{
m_value = old.getValue();
auto temp = old.getContectEdge();
m_contect_edge.resize(0);
for (auto aiter : temp)
{
m_contect_edge.push_back(aiter);
}
return *this;
}
inline Vertice(const Vertice & old)
{
m_value = old.getValue();
auto temp = old.getContectEdge();
m_contect_edge.resize(0);
for (auto aiter : temp)
{
m_contect_edge.push_back(aiter);
}
}
vector<qsize_t> getContectEdge()const noexcept;
void addContectEdge(qsize_t) noexcept;
void setContectEdge(qsize_t, qsize_t);
void setContectEdgebyID(qsize_t id, qsize_t value);
void deleteContectEdge(qsize_t);
int getValue() const noexcept;
void setValue(int) noexcept;
private:
vector<qsize_t> m_contect_edge;
int m_value;
};
typedef map<qsize_t, Vertice> vertice_map_t;
typedef vector<vertice_map_t> vertice_matrix_t;
class VerticeMatrix
{
public:
friend class VerticeMatrix;
VerticeMatrix();
VerticeMatrix(const VerticeMatrix &);
VerticeMatrix operator = (const VerticeMatrix &);
qsize_t getQubitCount() const;
qsize_t getVerticeCount() const;
void subVerticeCount();
qsize_t addVertice(qsize_t);
qsize_t addVertice(qsize_t, qsize_t);
qsize_t addVertice(qsize_t,qsize_t, Vertice &);
int getVerticeValue(qsize_t, qsize_t);
qsize_t getEmptyVertice();
void setVerticeValue(qsize_t, qsize_t, int);
void initVerticeMatrix(qsize_t);
map<qsize_t, Vertice>::iterator deleteVertice(qsize_t, qsize_t);
qsize_t getQubitVerticeLastID(qsize_t);
vector<qsize_t> getContectEdge(qsize_t, qsize_t) const;
vertice_matrix_t::iterator begin()noexcept;
vertice_matrix_t::iterator end()noexcept;
vertice_matrix_t::iterator getQubitMapIter(qsize_t qubit)noexcept;
vertice_map_t::iterator getQubitMapIterBegin(qsize_t qubit);
vertice_map_t::iterator getQubitMapIterEnd(qsize_t qubit);
vertice_map_t::iterator getVertice(qsize_t, qsize_t);
void addContectEdge(qsize_t, qsize_t, qsize_t);
void changeContectEdge(qsize_t, qsize_t, qsize_t,qsize_t);
void deleteContectEdge(qsize_t, qsize_t, qsize_t);
void clearVertice() noexcept;
~VerticeMatrix();
private:
qsize_t m_qubit_count;
qsize_t m_vertice_count;
vector<map<qsize_t, Vertice>> m_vertice_matrix;
};
class QuantumProgMap
{
private:
VerticeMatrix * m_vertice_matrix;
EdgeMap * m_edge_map;
public:
friend class QuantumProgMap;
QuantumProgMap()
{
m_vertice_matrix = new VerticeMatrix();
m_edge_map = new EdgeMap;
}
~QuantumProgMap()
{
delete m_vertice_matrix;
delete m_edge_map;
}
inline QuantumProgMap(const QuantumProgMap & old)
{
m_vertice_matrix = new VerticeMatrix(*(old.m_vertice_matrix));
m_edge_map = new EdgeMap(*(old.m_edge_map));
}
inline VerticeMatrix * getVerticeMatrix()
{
return m_vertice_matrix;
}
inline EdgeMap * getEdgeMap()
{
return m_edge_map;
}
inline void clearVerticeValue() noexcept
{
m_vertice_matrix->clearVertice();
}
qsize_t getVerticeCount() const;
};
#endif // !TENSOR_NODE_H
| [
"369038080@qq.com"
] | 369038080@qq.com |
c677a7c2237b720b5c68a733fc046c70798602d3 | cfeac52f970e8901871bd02d9acb7de66b9fb6b4 | /generated/src/aws-cpp-sdk-forecastquery/source/ForecastQueryServiceRequest.cpp | 11191a3b284cfa099a5e18e668ea3097d71af97f | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | aws/aws-sdk-cpp | aff116ddf9ca2b41e45c47dba1c2b7754935c585 | 9a7606a6c98e13c759032c2e920c7c64a6a35264 | refs/heads/main | 2023-08-25T11:16:55.982089 | 2023-08-24T18:14:53 | 2023-08-24T18:14:53 | 35,440,404 | 1,681 | 1,133 | Apache-2.0 | 2023-09-12T15:59:33 | 2015-05-11T17:57:32 | null | UTF-8 | C++ | false | false | 287 | cpp | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/forecastquery/ForecastQueryServiceRequest.h>
namespace Aws
{
namespace ForecastQueryService
{
} // namespace ForecastQueryService
} // namespace Aws
| [
"sdavtaker@users.noreply.github.com"
] | sdavtaker@users.noreply.github.com |
62723e215cc88ab92edca46ce23b3680fe779924 | 197d3b55039c01d3122a899ae3548a6c556e20df | /Schrage2.cpp | 411b1e6d90f9e07d6f00a03d652b998cb6df288f | [] | no_license | tadekj87/Schrage2 | 24e966971b99db8a7ff4333ed7a51f9685dc6c92 | de82669cc5cb9307fedd632c6c3f8c9b5d5ebfc7 | refs/heads/master | 2021-04-24T04:27:22.260778 | 2020-03-31T20:18:13 | 2020-03-31T20:18:13 | 250,076,949 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,433 | cpp | //Schrage2.cpp : Ten plik zawiera funkcję „main”.W nim rozpoczyna się i kończy wykonywanie programu.
// Grupa: WT 13: Junak Tadeusz, Karol Kędzia
#include <iostream>
#include <fstream>
#include <queue>
#include <vector>
using namespace std;
struct strukturaZadania
{
int r,p,q; // termin dostępności r (punkt), czas wykonania p (okres), czas dostarczenia q
strukturaZadania(int a, int b, int c)
{
r = a; p = b; q = c;
}
};
struct kolejnoscR
{
bool operator ()( const strukturaZadania& a, const strukturaZadania& b ) const
{
return a.r > b.r;
}
};
struct kolejnoscQ
{
bool operator ()( const strukturaZadania& a, const strukturaZadania& b ) const
{
return a.q < b.q;
}
};
// zbiory G i N to kolejki priorytetowe
priority_queue<strukturaZadania, vector<strukturaZadania>, kolejnoscQ> zbiorG; // zbiór G jest porządkowany rosnąco po większej wartości "q"
priority_queue<strukturaZadania, vector<strukturaZadania>, kolejnoscR> zbiorN; // zbiór N jest porządkowany rosnąco po mniejszej wartości "r"
int main()
{
fstream plik;
plik.open("SCHRAGE2.dat",ios::in);
int rozmiar=0;
int r,p,q;
int t, k, Cmax;
t = k = Cmax = 0;
plik >> rozmiar;
cout << "Kolejnosc: r p q" << endl;
strukturaZadania e(0, 0, 0); // zadanie pomocnicze "e"
for (int i=0; i<rozmiar; i++)
{
plik >> r;
plik >> p;
plik >> q;
cout << r << "\t" << p << "\t" << q << endl;
strukturaZadania zadanie(r,p,q); // każde zadanie ląduje
zbiorN.push(zadanie); // w zbiorze N
}
// algorytm
while(zbiorG.empty()==false || zbiorN.empty()==false)
{
while(zbiorN.empty()==false && zbiorN.top().r<= t)
{
e = zbiorN.top();
zbiorG.push(e); // zadanie "e" dodawane do zbioru G z "czubka" zbioru N
zbiorN.pop(); // ściągnięcie "e" z czubka N
}
if (zbiorG.empty() == true)
{
t = zbiorN.top().r; // "t" jest równe najmniejszej wartości zbioru N
continue; // pomija się dalsze kroki i przechodzi do kolejnej pętli
}
e = zbiorG.top(); // "e" jest ściągane z czubka "G"
zbiorG.pop();
k = k+1;
t=t+e.p;
if (Cmax < t + e.q)
Cmax = t + e.q;
}
// wyswietlenie rozmiaru i Cmax
cout << endl << "Rozmiar to: "<< rozmiar << endl;
cout << "Cmax to: " << Cmax << endl;
system("PAUSE");
return 0;
}
| [
"156414@student.pwr.edu.pl"
] | 156414@student.pwr.edu.pl |
ce6833646b2ebbcc59f17b49fa2b81db45831e1a | 1286c5b3d37b0785e99073c8234b44df47561f5a | /2020/0307_ABC158/F.cpp | a4fdefcfdeccd68603871ebd5a7ab951f6b448ff | [
"MIT"
] | permissive | kazunetakahashi/atcoder | 930cb5a0f4378914cc643de2f0596a5de7e4a417 | 16ce65829ccc180260b19316e276c2fcf6606c53 | refs/heads/master | 2022-02-15T19:12:10.224368 | 2022-01-29T06:38:42 | 2022-01-29T06:38:42 | 26,685,318 | 7 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 17,328 | cpp | #define DEBUG 1
/**
* File : F.cpp
* Author : Kazune Takahashi
* Created : 6/19/2020, 12:05:07 AM
* Powered by Visual Studio Code
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// ----- boost -----
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
// ----- using directives and manipulations -----
using namespace std;
using boost::rational;
using boost::integer::gcd; // for C++14 or for cpp_int
using boost::integer::lcm; // for C++14 or for cpp_int
using boost::multiprecision::cpp_int;
using ll = long long;
using ld = long double;
template <typename T>
using max_heap = priority_queue<T>;
template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
// ----- constexpr for Mint and Combination -----
// constexpr ll MOD{1'000'000'007LL};
constexpr ll MOD{998'244'353LL}; // be careful
constexpr ll MAX_SIZE{3'000'010LL};
// constexpr ll MAX_SIZE{30'000'010LL}; // if 10^7 is needed
// ----- ch_max and ch_min -----
template <typename T>
bool ch_max(T &left, T right)
{
if (left < right)
{
left = right;
return true;
}
return false;
}
template <typename T>
bool ch_min(T &left, T right)
{
if (left > right)
{
left = right;
return true;
}
return false;
}
// ----- Mint -----
template <ll MOD = MOD>
class Mint
{
public:
ll x;
Mint() : x{0LL} {}
Mint(ll x) : x{(x % MOD + MOD) % MOD} {}
Mint operator-() const { return x ? MOD - x : 0; }
Mint &operator+=(Mint const &a)
{
if ((x += a.x) >= MOD)
{
x -= MOD;
}
return *this;
}
Mint &operator-=(Mint const &a) { return *this += -a; }
Mint &operator++() { return *this += 1; }
Mint operator++(int)
{
Mint tmp{*this};
++*this;
return tmp;
}
Mint &operator--() { return *this -= 1; }
Mint operator--(int)
{
Mint tmp{*this};
--*this;
return tmp;
}
Mint &operator*=(Mint const &a)
{
(x *= a.x) %= MOD;
return *this;
}
Mint &operator/=(Mint const &a)
{
Mint b{a};
return *this *= b.power(MOD - 2);
}
Mint operator+(Mint const &a) const { return Mint(*this) += a; }
Mint operator-(Mint const &a) const { return Mint(*this) -= a; }
Mint operator*(Mint const &a) const { return Mint(*this) *= a; }
Mint operator/(Mint const &a) const { return Mint(*this) /= a; }
bool operator<(Mint const &a) const { return x < a.x; }
bool operator<=(Mint const &a) const { return x <= a.x; }
bool operator>(Mint const &a) const { return x > a.x; }
bool operator>=(Mint const &a) const { return x >= a.x; }
bool operator==(Mint const &a) const { return x == a.x; }
bool operator!=(Mint const &a) const { return !(*this == a); }
Mint power(ll N) const
{
if (N == 0)
{
return 1;
}
else if (N % 2 == 1)
{
return *this * power(N - 1);
}
else
{
Mint half = power(N / 2);
return half * half;
}
}
};
template <ll MOD>
Mint<MOD> operator+(ll lhs, Mint<MOD> const &rhs) { return rhs + lhs; }
template <ll MOD>
Mint<MOD> operator-(ll lhs, Mint<MOD> const &rhs) { return -rhs + lhs; }
template <ll MOD>
Mint<MOD> operator*(ll lhs, Mint<MOD> const &rhs) { return rhs * lhs; }
template <ll MOD>
Mint<MOD> operator/(ll lhs, Mint<MOD> const &rhs) { return Mint<MOD>{lhs} / rhs; }
template <ll MOD>
istream &operator>>(istream &stream, Mint<MOD> &a) { return stream >> a.x; }
template <ll MOD>
ostream &operator<<(ostream &stream, Mint<MOD> const &a) { return stream << a.x; }
// ----- Combination -----
template <ll MOD = MOD, ll MAX_SIZE = MAX_SIZE>
class Combination
{
public:
vector<Mint<MOD>> inv, fact, factinv;
Combination() : inv(MAX_SIZE), fact(MAX_SIZE), factinv(MAX_SIZE)
{
inv[1] = 1;
for (auto i{2LL}; i < MAX_SIZE; i++)
{
inv[i] = (-inv[MOD % i]) * (MOD / i);
}
fact[0] = factinv[0] = 1;
for (auto i{1LL}; i < MAX_SIZE; i++)
{
fact[i] = Mint<MOD>(i) * fact[i - 1];
factinv[i] = inv[i] * factinv[i - 1];
}
}
Mint<MOD> operator()(int n, int k)
{
if (n >= 0 && k >= 0 && n - k >= 0)
{
return fact[n] * factinv[k] * factinv[n - k];
}
return 0;
}
Mint<MOD> catalan(int x, int y)
{
return (*this)(x + y, y) - (*this)(x + y, y - 1);
}
};
// ----- for C++14 -----
using mint = Mint<MOD>;
using combination = Combination<MOD, MAX_SIZE>;
// ----- for C++17 -----
template <typename T, typename enable_if<is_integral<T>::value>::type * = nullptr>
size_t popcount(T x) { return bitset<64>(x).count(); }
size_t popcount(string const &S) { return bitset<200010>{S}.count(); }
// ----- Infty -----
template <typename T>
constexpr T Infty() { return numeric_limits<T>::max(); }
template <typename T>
constexpr T mInfty() { return numeric_limits<T>::min(); }
// ----- frequently used constexpr -----
// constexpr double epsilon{1e-10};
// constexpr ll infty{1'000'000'000'000'010LL}; // or
// constexpr int infty{1'000'000'010};
// constexpr int dx[4] = {1, 0, -1, 0};
// constexpr int dy[4] = {0, 1, 0, -1};
// ----- Yes() and No() -----
void Yes()
{
cout << "Yes" << endl;
exit(0);
}
void No()
{
cout << "No" << endl;
exit(0);
}
// ----- SegTree -----
// Referring to the following great materials.
// - tsutaj-san's article: https://tsutaj.hatenablog.com/entry/2017/03/30/224339
// - drken-san's article: https://drken1215.hatenablog.com/entry/2019/02/19/110200
// - tsutaj-san's libary: https://tsutaj.github.io/cpp_library/library/structure/strc_021_dynamic_lazy_segtree.cpp.html
// Many thanks to them.
template <typename Monoid, typename Action>
class SegTree
{
struct SegNode
{
bool need_update;
unique_ptr<SegNode> left, right;
Monoid value;
Action lazy_value;
// constructor
SegNode() {}
SegNode(Monoid value, Action lazy_value)
: need_update{false},
left{nullptr},
right{nullptr},
value{value},
lazy_value{lazy_value} {}
// copy constructor
SegNode(SegNode const &node)
: need_update{node.need_update},
value{node.value},
lazy_value{node.lazy_value}
{
if (node.left)
{
left = make_unique<SegNode>(*(node.left));
}
if (node.right)
{
left = make_unique<SegNode>(*(node.right));
}
}
// copy assignment
SegNode &operator=(SegNode const &node)
{
SegNode tmp{node};
swap(tmp, *this);
return *this;
}
// move constructor
SegNode(SegNode &&node)
: need_update{node.need_update},
left{move(node.left)},
right{move(node.right)},
value{node.value},
lazy_value{node.lazy_value} {}
// move assignment
SegNode &operator=(SegNode &&node)
{
swap(need_update, node.need_update);
swap(left, node.left);
swap(right, node.right);
swap(value, node.value);
swap(lazy_value, node.lazy_value);
return *this;
}
};
using FuncAction = function<void(Monoid &, Action)>;
using FuncMonoid = function<Monoid(Monoid, Monoid)>;
using FuncLazy = function<void(Action &, Action)>;
using FuncIndex = function<Action(Action, int)>;
// fields
int N;
unique_ptr<SegNode> root;
// unities
Monoid unity_monoid;
Action unity_action;
// functions
FuncAction func_update;
FuncMonoid func_combine;
FuncLazy func_lazy;
FuncIndex func_accumulate;
public:
// constructor
SegTree() {}
SegTree(
int n, Monoid unity_monoid, Action unity_action,
FuncAction func_update,
FuncMonoid func_combine,
FuncLazy func_lazy,
FuncIndex func_accumulate)
: N{1}, root{make_unique<SegNode>(unity_monoid, unity_action)},
unity_monoid{unity_monoid}, unity_action{unity_action},
func_update{func_update},
func_combine{func_combine},
func_lazy{func_lazy},
func_accumulate{func_accumulate}
{
while (N < n)
{
N <<= 1;
}
}
// copy constructor
SegTree(SegTree const &tree)
: N{tree.N}, unity_monoid{tree.unity_monoid}, unity_action{tree.unity_action},
func_update{tree.func_update},
func_combine{tree.func_combine},
func_lazy{tree.func_lazy},
func_accumulate{tree.func_accumulate}
{
if (tree.root)
{
root = make_unique<SegNode>(*(tree.root));
}
}
// copy assignment
SegTree &operator=(SegTree const &tree)
{
SegTree tmp{tree};
swap(tmp, *this);
return *this;
}
// move constructor
SegTree(SegTree &&tree)
: N{tree.N}, root{move(tree.root)},
unity_monoid(tree.unity_monoid), unity_action(tree.unity_action),
func_update{tree.func_update},
func_combine{tree.func_combine},
func_lazy{tree.func_lazy},
func_accumulate{tree.func_accumulate} {}
// move assignment
SegTree &operator=(SegTree &&tree)
{
swap(N, tree.N);
swap(root, tree.root);
swap(unity_monoid, tree.unity_monoid);
swap(unity_action, tree.unity_action);
swap(func_update, tree.func_update);
swap(func_combine, tree.func_combine);
swap(func_lazy, tree.func_lazy);
swap(func_accumulate, tree.func_accumulate);
return *this;
}
void update(int a, int b, Action const &x) { update(root.get(), a, b, x, 0, N); }
void update(int a, Action const &x) { update(a, a + 1, x); }
Monoid query(int a, int b) { return query(root.get(), a, b, 0, N); }
Monoid query(int a) { return query(a, a + 1); }
Monoid operator[](size_t i) { return query(static_cast<int>(i)); }
private:
void node_maker(unique_ptr<SegNode> &pt) const
{
if (!pt)
{
pt = make_unique<SegNode>(unity_monoid, unity_action);
}
}
void evaluate(SegNode *node, int l, int r)
{
if (!node->need_update)
{
return;
}
func_update(node->value, func_accumulate(node->lazy_value, r - l));
if (r - l > 1)
{
node_maker(node->left);
func_lazy(node->left->lazy_value, node->lazy_value);
node->left->need_update = true;
node_maker(node->right);
func_lazy(node->right->lazy_value, node->lazy_value);
node->right->need_update = true;
}
node->lazy_value = unity_action;
node->need_update = false;
}
void update(SegNode *node, int a, int b, Action const &x, int l, int r)
{
evaluate(node, l, r);
if (b <= l || r <= a)
{
return;
}
if (a <= l && r <= b)
{
func_lazy(node->lazy_value, x);
node->need_update = true;
evaluate(node, l, r);
}
else
{
auto mid{(l + r) >> 1};
node_maker(node->left);
update(node->left.get(), a, b, x, l, mid);
node_maker(node->right);
update(node->right.get(), a, b, x, mid, r);
node->value = func_combine(node->left->value, node->right->value);
}
}
Monoid query(SegNode *node, int a, int b, int l, int r)
{
if (b <= l || r <= a)
{
return unity_monoid;
}
evaluate(node, l, r);
if (a <= l && r <= b)
{
return node->value;
}
auto mid{(l + r) >> 1};
auto vl{(node->left ? query(node->left.get(), a, b, l, mid) : unity_monoid)};
auto vr{(node->right ? query(node->right.get(), a, b, mid, r) : unity_monoid)};
return func_combine(vl, vr);
}
};
// ----- RangePlusQuery -----
// - update(i, x) : a[i] += x;,
// - update(s, t, x) : a[i] += x; for all i \in [s, t),
// - query(i) : return a[i];,
// - query(s, t) : return the sum a[i] where i runs on [s, t).
// ----- RangeSumQuery -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=ja
// - update(i, x) : a[i] += x;,
// - query(s, t) : return the sum a[i] where i runs on [s, t).
// ----- RangeAddQuery -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_E&lang=ja
// - update(s, t, x) : a[i] += x; for all i \in [s, t),
// - query(i) : return a[i].
// ----- RSU_RAU -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_G&lang=ja
// - update(s, t, x) : a[i] += x; for all i \in [s, t),
// - query(s, t) : return the sum a[i] where i runs on [s, t).
template <typename Monoid>
SegTree<Monoid, Monoid> RangePlusQuery(int N, Monoid const &monoid_zero)
{
using Action = Monoid;
return SegTree<Monoid, Action>{
N, monoid_zero, monoid_zero,
[](Monoid &x, Action y) { x += y; },
[](Monoid x, Monoid y) { return x + y; },
[](Action &x, Action y) { return x += y; },
[](Action x, int y) { return x * static_cast<Action>(y); }};
}
template <typename Monoid>
SegTree<Monoid, Monoid> RangePlusQuery(int N)
{
return RangePlusQuery<Monoid>(N, 0);
}
// ----- RangeMinQuery -----
// - update(i, x) : a[i] = x;,
// - update(s, t, x) : a[i] = x; for all i \in [s, t),
// - query(i) : return a[i];,
// - query(s, t) : return the minimum of a[i] where i runs on [s, t).
// ----- RangeMinimumQuery -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=ja
// - update(i, x) : a[i] = x;,
// - query(s, t) : return the minimum of a[i] where i runs on [s, t).
// ----- RangeUpdateQuery -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_D&lang=ja
// - update(s, t, x) : a[i] = x; for all i \in [s, t),
// - query(i) : return a[i].
// ----- RMQ_RUQ -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_F&lang=ja
// - update(s, t, x) : a[i] = x; for all i \in [s, t),
// - query(s, t) : return the minimum of a[i] where i runs on [s, t).
template <typename Monoid>
SegTree<Monoid, Monoid> RangeMinQuery(int N, Monoid const &monoid_infty)
{
using Action = Monoid;
return SegTree<Monoid, Action>{
N, monoid_infty, monoid_infty,
[](Monoid &x, Action y) { x = y; },
[](Monoid x, Monoid y) { return min(x, y); },
[](Action &x, Action y) { return x = y; },
[](Action x, int) { return x; }};
}
template <typename Monoid>
SegTree<Monoid, Monoid> RangeMinQuery(int N)
{
return RangeMinQuery<Monoid>(N, numeric_limits<Monoid>::max());
}
// ----- RMQ_RAQ -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_H&lang=ja
// - update(s, t, x) : a[i] += x; for all i \in [s, t),
// - query(s, t) : return the minimum of a[i] where i runs on [s, t).
// update should be called as follows.
// tree.update(s, t, make_tuple(x, true));
template <typename Monoid>
SegTree<Monoid, tuple<Monoid, bool>> RMQ_RAQ(int N, Monoid const &monoid_zero, Monoid const &monoid_infty)
{
using Action = tuple<Monoid, bool>;
auto tree{SegTree<Monoid, Action>{
N, monoid_infty, Action{monoid_zero, true},
[](Monoid &x, Action y) {
if (get<1>(y))
{
x += get<0>(y);
}
else
{
x = get<0>(y);
}
},
[](Monoid x, Monoid y) { return min(x, y); },
[](Action &x, Action y) {
if (get<1>(y))
{
get<0>(x) += get<0>(y);
}
else
{
x = y;
}
},
[](Action x, int) { return x; }}};
tree.update(0, N, Action{monoid_zero, false});
return tree;
}
template <typename Monoid>
SegTree<Monoid, tuple<Monoid, bool>> RMQ_RAQ(int N)
{
return RMQ_RAQ<Monoid>(N, 0, numeric_limits<Monoid>::max());
}
// ----- RSQ_RUQ -----
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_I&lang=ja
// - update(s, t, x) : a[i] = x; for all i \in [s, t),
// - query(s, t) : return the sum of a[i] where i runs on [s, t).
template <typename Monoid>
SegTree<Monoid, Monoid> RSQ_RUQ(int N, Monoid const &monoid_zero)
{
using Action = Monoid;
return SegTree<Monoid, Action>{
N, monoid_zero, monoid_zero,
[](Monoid &x, Action y) { x = y; },
[](Monoid x, Monoid y) { return x + y; },
[](Action &x, Action y) { return x = y; },
[](Action x, int y) { return x * static_cast<Action>(y); }};
}
template <typename Monoid>
SegTree<Monoid, Monoid> RSQ_RUQ(int N)
{
return RSQ_RUQ<Monoid>(N, 0);
}
// ----- Solve -----
using Robot = tuple<ll, ll>;
class Solve
{
int N;
vector<Robot> robots;
public:
Solve(int N) : N{N}, robots(N)
{
for (auto i{0}; i < N; ++i)
{
auto &[x, d] = robots[i];
cin >> x >> d;
}
sort(robots.rbegin(), robots.rend());
}
void flush()
{
auto tree{RangeMinQuery<int>(N)};
for (auto i{0}; i < N; ++i)
{
auto [x, d]{robots[i]};
int ng{-1}, ok{i};
while (abs(ok - ng) > 1)
{
int t{(ng + ok) / 2};
if (get<0>(robots[t]) < x + d)
{
ok = t;
}
else
{
ng = t;
}
}
tree.update(i, min(i, tree.query(ok, i)));
}
vector<mint> DP(N + 1);
DP[0] = 1;
for (auto i{0}; i < N; ++i)
{
DP[i + 1] = DP[i] + DP[tree[i]];
}
cout << DP[N] << endl;
}
private:
};
// ----- main() -----
int main()
{
int N;
cin >> N;
Solve solve(N);
solve.flush();
}
| [
"kazunetakahashi@gmail.com"
] | kazunetakahashi@gmail.com |
a98cf2240620d97ab41f1917d75b16b013e859a1 | 0c98ea8b4d860692cda46d1b1b190b3512f880db | /operations.cpp | 2da6b5b5b055a281f2be7b55e0bc7c65614f2c83 | [] | no_license | Hybin/Shuuseki | b56f6b15d196effbcaf271b8a45aa7dea00c0daf | edb33a4ef9ba96a73f4fdf34fa059a7cc2f1b090 | refs/heads/master | 2020-03-19T13:03:00.200523 | 2018-07-04T06:36:45 | 2018-07-04T06:36:45 | 136,557,290 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,900 | cpp | //
// Created by Hybin on 2018/6/9.
//
#include <iostream>
#include <vector>
#include <sstream>
#include "include/Corpus.h"
using namespace std;
string project;
map<string, map<string, vector<vector<int>>>> indexes;
int create(const string &corpusName)
{
if (check(corpusName)) {
cerr << "-Shuuseki: The Corpus has been created. Do not build it again!" << endl;
}
// Create a Corpus Object
Corpus Shuuseki;
Shuuseki.CorpusName = corpusName;
Shuuseki.FileList = {};
// Store the basic info of the corpus
fstream init("corpora.index", ios_base::out | ios_base::in | ios_base::app);
init << Shuuseki.CorpusName + "\n";
init.close();
// Create a file for the Corpus
fstream corpus;
corpus.open(corpusName + ".corpus", ios_base::out | ios_base::in | ios_base::app);
if (!corpus) {
cerr << "-Shuuseki: Failed to create a corpus" << endl;
}
corpus.close();
// Show status
cout << "-Shuuseki: A corpus called [" + corpusName + "] has been created successful" << endl;
project = Shuuseki.CorpusName;
return 0;
}
int open(const string &corpusName)
{
string cmd;
// Open the corpus with read / write mode
fstream corpus;
corpus.open(corpusName + ".corpus", ios_base::in);
if (!corpus) {
cerr << "-Shuuseki: Failed to open a corpus" << endl;
return -1;
}
cout << "-Shuuseki: Please wait for a minute..." << endl;
indexes = getDataFromCorpus(corpus);
project = corpusName;
corpus.close();
cout << "-Shuuseki: Corpus [" + corpusName +"] has been opened." << endl;
return 0;
}
int check() // Check if a Corpus has been opened or created
{
if (project.empty()) {
cerr << "-Shuuseki: Caution: You may need to create a Corpus or open one" << endl;
return -1;
}
return 0;
}
int import(const vector<string> &files)
{
check();
cout << "-Shuuseki: Please wait for a minute..." << endl;
// Create an Object to store the information.
Corpus Shuuseki;
Shuuseki.CorpusName = project;
for (auto &index: indexes)
Shuuseki.FileList.push_back(index.first);
fstream imported_corpus(project + ".corpus", ios_base::out | ios_base::in | ios_base::app | ios_base::ate);
if (!imported_corpus) {
cerr << "-Shuuseki: corpus not exist" << endl;
return -1;
}
// Make a record of the number of imported files
int count = 0;
for (auto &file : files) {
// Test if it has existed
if (match(Shuuseki.FileList, file) != -1) {
cerr << "-Shuuseki: The file [" + file + "] has existed." << endl;
continue;
}
fstream in(file);
if (!in) {
cerr << "File [" + file + "] not exist" << endl;
continue;
}
string encoding = checkEncoding(file);
map<string, map<string, vector<vector<int>>>> inventory;
if ((encoding != "UTF-8") && (encoding != "UTF-8 with BOM")) {
transform(file);
fstream raw("convert-output.txt", ios_base::in);
inventory = preprocessing(raw, file);
raw.close();
remove("convert-output.txt");
} else {
inventory = preprocessing(in, file);
}
in.close();
indexes.insert(inventory.begin(), inventory.end());
writeIndiceIntoCorpus(inventory, imported_corpus);
Shuuseki.FileList.push_back(file);
++count;
}
imported_corpus.close();
cout << "-Shuuseki: You have been imported " + to_string(count) + " files " + "into the Corpus [" + Shuuseki.CorpusName + "] successfully" << endl;
return 0;
}
int remove(const vector<string> &files)
{
check();
cout << "-Shuuseki: Please wait for a minute..." << endl;
// Create an Object to store the information.
Corpus Shuuseki;
Shuuseki.CorpusName = project;
for (auto &index: indexes)
Shuuseki.FileList.push_back(index.first);
// Delete the content
int count = 0, record = static_cast<int>(indexes.size());
for (auto &file : files) {
string tfile = transInput(file);
int pos = match(Shuuseki.FileList, tfile);
if (pos == -1) continue;
map<string, map<string, vector<vector<int>>>>::iterator item;
item = indexes.find(tfile);
if (item != indexes.end())
indexes.erase(tfile);
Shuuseki.FileList.erase(Shuuseki.FileList.begin() + pos);
++count;
}
// Write the left content into corpus
if (indexes.size() != record) {
fstream updated_corpus(project + ".corpus", ios_base::out | ios_base::trunc);
writeIndiceIntoCorpus(indexes, updated_corpus);
updated_corpus.close();
}
cout << "-Shuuseki: You have delete " + to_string(count) + " files successfully from Corpus [" + Shuuseki.CorpusName + "]" << endl;
return 0;
}
// Custom Functions for vector sorting
// Sort by int
struct IntCmp {
bool operator()(const pair<string, int> &lhs, const pair<string, int> &rhs)
{
return lhs.second > rhs.second;
}
};
// Sort by Pinyin
map<string, int> HFKaiji = generate();
struct AlpCmp {
bool operator()(const pair<string, int> &lhs, const pair<string, int> &rhs)
{
string lhsFirst = hex_to_string(string_to_hex(lhs.first).substr(0, 6)),
rhsFisrt = hex_to_string(string_to_hex(rhs.first).substr(0, 6));
if ((HFKaiji.find(lhsFirst) != HFKaiji.end()) && (HFKaiji.find(rhsFisrt) != HFKaiji.end()))
return HFKaiji[lhsFirst] < HFKaiji[rhsFisrt];
else
return false;
}
};
// Complex sort: 1) base on line_no; 2) base on character_no;
struct CompIntCmp {
bool operator()(const pair<string, vector<int>> &lhs, const pair<string, vector<int>> &rhs)
{
if (lhs.second[0] < rhs.second[0])
return true;
else if (lhs.second[0] == rhs.second[0])
return lhs.second[1] < rhs.second[1];
return false;
}
};
int show(const string &corpusName)
{
check();
cout << "-Shuuseki: Please wait for a minute..." << endl;
// Create an Object to store the information.
Corpus Shuuseki;
Shuuseki.CorpusName = project;
for (auto &index: indexes)
Shuuseki.FileList.push_back(index.first);
int charactersNum = 0;
map<string, map<string, vector<vector<int>>>>::iterator item;
for (item = indexes.begin(); item != indexes.end(); ++item)
for (auto & c : item -> second)
charactersNum += c.second.size();
cout << "-Shuuseki: In Corpus [" + Shuuseki.CorpusName + "], there are " + to_string(Shuuseki.FileList.size()) + " imported files, "
<< "almost " + to_string(charactersNum) + " characters(Kanji or English words)." << endl;
cout << " And later you will see the Kanji with top 20 occurrences. Please wait for a minute......(only if your Corpus is big)" << endl;
// Count the occurrences of characters
map<string, int> wordOccurrences;
countOccurrence(indexes, wordOccurrences);
// Sort the map
vector<pair<string, int>> result(wordOccurrences.begin(), wordOccurrences.end());
sort(result.begin(), result.end(), IntCmp());
for (int i = 0; i < 20; ++i) {
cout << " " << transOutput(result[i].first) << " occurs " << result[i].second << ((result[i].second > 1) ? " times" : " time") << endl;
}
return 0;
}
int count(vector<string> options)
{
if (options.size() != 5 && options[0] != "-a" && options[0] != "-f") {
cerr << "-Shuuseki: missing options. Please input command [sort] with correct options." << endl;
return -1;
}
check();
cout << "-Shuuseki: Please wait for a minute..." << endl;
// Get characters from indexes and rebuild into sentences
vector<string> content;
vector<pair<string, vector<int>>> sentences;
map<string, map<string, vector<vector<int>>>>::iterator item;
for (item = indexes.begin(); item != indexes.end(); ++item) {
vector<pair<string, vector<int>>> kanji;
for (auto & c : item -> second)
for (auto &i : c.second)
kanji.emplace_back(c.first, i);
sort(kanji.begin(), kanji.end(), CompIntCmp());
sentences.insert(sentences.end(), kanji.begin(), kanji.end());
}
content.reserve(sentences.size());
for (auto &sentence : sentences)
content.push_back(sentence.first);
// n_gram string frequency statistic
int n_min = stoi(options[1]), n_max = stoi(options[2]), f_min = stoi(options[3]), f_max = stoi(options[4]);
map<string, int> stringOccurrences = n_gram(n_min, n_max, content, f_min, f_max);
vector<pair<string, int>> temp(stringOccurrences.begin(), stringOccurrences.end()), result;
// Reduce the number of elements which need to be sorted
// And it make sense
for (auto &t : temp)
if (t.second >= f_min && t.second <= f_max)
result.push_back(t);
ofstream out("recurrence.txt", ios_base::out | ios_base::trunc);
if (options[0] == "-f") {
sort(result.begin(), result.end(), IntCmp());
} else {
sort(result.begin(), result.end(), AlpCmp());
}
out << " 频次" << "\t\t" << "字符串" << endl;
for (auto &r : result) {
out << " " << r.second << "\t\t" << r.first << endl;
}
out.close();
cout << "-Shuuseki: Finished! You could read the result in recurrence.txt. " << endl;
return 0;
}
// Just for search
string merge(vector<pair<string, vector<int>>> sentence, const int &start, const int &length)
{
string s;
for (int i = start; i < (length + start); ++i) {
s += sentence[i].first;
}
return s;
}
string complete(string &serial)
{
while (serial.size() < 7)
serial = "0" + serial;
return serial;
}
int search(vector<string> options)
{
if (options.size() != 4) {
cerr << "-Shuuseki: missing options. Please input command [sort] with correct options." << endl;
return -1;
}
check();
cout << "-Shuuseki: Please wait for a minute..." << endl;
string source = transInput(options[0]), goal = transInput(options[3]);
int rangeMin = stoi(options[1]), rangeMax =stoi(options[2]);
vector<pair<string, vector<int>>> sentences;
map<string, map<string, vector<vector<int>>>>::iterator item;
vector<pair<int, string>> results;
for (item = indexes.begin(); item != indexes.end(); ++item) {
vector<pair<string, vector<int>>> kanji;
vector<vector<int>> anchor;
for (auto & c : item -> second)
for (auto &i : c.second)
kanji.emplace_back(c.first, i);
sort(kanji.begin(), kanji.end(), CompIntCmp());
for (auto &it : kanji) {
if (it.first == source)
anchor.push_back({it.second[0], it.second[1]});
}
for (auto &a : anchor) {
vector<pair<string, vector<int>>> sentence;
for (auto &k : kanji) {
if (k.second[0] == a[0])
sentence.push_back(k);
}
// Expand the length of the sentence
int end = a[1] + rangeMax + 1, start = a[1] + rangeMin + 1, increment = 1;
while (end > sentence.size()) {
for (auto &k : kanji) {
if (k.second[0] == (a[0] + increment))
sentence.push_back(k);
}
++increment;
}
while (start <= end) {
if (sentence[start].first == goal) {
string front = merge(sentence, 0, a[1]),
middle = merge(sentence, a[1], start + 1 - a[1]),
last = merge(sentence, start + 1, static_cast<int>(sentence.size() - start - 1));
stringstream ss;
ss << " from [" << (item -> first) << "]: "<< front << " *" << middle << "* " << last;
results.emplace_back(a[0], ss.str());
++start;
} else {
++start;
}
}
}
}
ofstream out("results.txt", ios_base::out | ios_base::trunc);
out << "-------------------------------------" << endl;
if (!results.empty())
out << "+ " << results.size() << " sentences found and listed blow:" << endl;
else
out << "404 Not Found" << endl;
out << "-------------------------------------" << '\n' <<endl;
for (auto &r : results) {
string serial = to_string(r.first);
if (serial.size() < 7)
complete(serial);
out << "line " << serial << r.second << endl;
}
cout << "-Shuuseki: Finished! You could read the result in result.txt. " << endl;
return 0;
}
| [
"hhb8550@live.com"
] | hhb8550@live.com |
5d094e867012fa6b32593abae3c2ff0ede49b633 | 30fe760333a4fe87863b8f7a6cea035e236b869b | /数据结构与算法/算法竞赛入门经典/Code/第三章 数组和字符串/蛇形填数.cpp | 8ab11e13ce2914fa064c61248de0a944ed6a6417 | [] | no_license | Floral/Study | 782e1028abed4eba6c7dcc773b01834752fe32f1 | e023fe907a9a1e5330d5283f81ed3e5af0d8f124 | refs/heads/master | 2021-12-15T00:03:44.412499 | 2021-11-23T13:37:43 | 2021-11-23T13:37:43 | 184,597,375 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 863 | cpp | #include<stdio.h>
#include<string.h>
#define maxm 20
#define maxn 20
int matrix[maxm][maxn];
int main()
{
int i=1,n;
int x,y;
memset(matrix,0,sizeof(matrix)); //矩阵全部置零
scanf("%d",&n);
x=0,y=n-1;
matrix[x][y]=1;
while(i<n*n)
{
/* code */
while(x<n-1 && !matrix[x+1][y]){
matrix[++x][y] = ++i;
}
while(y>0 && !matrix[x][y-1]){
matrix[x][--y] = ++i;
}
while(x>0 && !matrix[x-1][y]){
matrix[--x][y] = ++i;
}
while(y<n-1 && !matrix[x][y+1]){
matrix[x][++y] = ++i;
}
}
for(size_t i = 0; i < n; i++)
{
/* code */
for(size_t j = 0; j < n; j++)
{
/* code */
printf("%3d",matrix[i][j]);
}
printf("\n");
}
return 0;
} | [
"lqw1825830267@gmail.com"
] | lqw1825830267@gmail.com |
616dde253783200f889c7115d084710fccf89a75 | 7b0d12c1a7c31ba3bad0aedb550109df2da74e71 | /parser.cpp | 9b8963fe78932af7515ae9070122d01490c1ac84 | [] | no_license | BSC-RM/slurm_simulator_deepest | 210dc1f52c9c99b2d6c5f1fd86c68bc2c8ed5d8c | 4f1fe75c196430cb4e46aa627967d3108052fe24 | refs/heads/master | 2023-03-29T11:14:52.244816 | 2020-04-07T16:21:40 | 2020-04-07T16:21:40 | 352,705,480 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,604 | cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#define MIN_RUNTIME 60
using namespace std;
int CM = 0, ESB = 0, DAM = 0, jobs = 0;
int globalWaitTime = 0, globalResponseTime = 0;
double globalSlowDown = 0, globalBoundedSlowDown = 0;
vector <int> waitTimeCM, waitTimeESB, waitTimeDAM;
vector <int> responseTimeCM, responseTimeESB, responseTimeDAM;
vector <double> slowDownCM, slowDownESB, slowDownDAM;
vector <double> boundedSlowDownCM, boundedSlowDownESB, boundedSlowDownDAM;
string split(const string& str, const string& delim) {
vector<string> tokens;
size_t prev = 0, pos = 0;
do {
pos = str.find(delim, prev);
if (pos == string::npos)
pos = str.length();
string token = str.substr(prev, pos-prev);
if (!token.empty())
tokens.push_back(token);
prev = pos + delim.length();
} while (pos < str.length() && prev < str.length());
if (tokens.size() > 1)
return tokens[1];
else
return "NULL";
}
void parseFile (ifstream *input, ofstream *output) {
int waitTime = 0, responseTime = 0;
double slowDown = 0, boundedSlowDown = 0;
string line;
*output << "JobId Partition NodeCn waitTime responseTime slowDown boundedSlowDown runTime" << endl;
while (getline(*input, line)) {
int submitTime = 0, startTime = 0, endTime = 0, runTime = 0;
stringstream ss(line);
string entry, parsed;
vector<string> row;
++jobs;
while (ss >> entry) {
parsed = split(entry,"=");
row.push_back(parsed);
}
submitTime = stoi(row[7]);
startTime = stoi(row[8]);
endTime = stoi(row[9]);
runTime = endTime - startTime;
waitTime = startTime - submitTime;
responseTime = endTime - submitTime;
slowDown = (waitTime + runTime) / static_cast <double> (runTime);
boundedSlowDown = (waitTime + max(runTime,MIN_RUNTIME)) / static_cast <double> (max(runTime,MIN_RUNTIME));
// JobId Partition NodeCn waitTime responseTime slowDown boundedSlowDown runTime
*output << row[0] << " " << row[5] << " " << row[11] << " " << waitTime << " " << responseTime << " " << slowDown << " " << boundedSlowDown << " " << runTime << endl;
if (row[5].substr(0,2) == "CM") {
CM++;
waitTimeCM.push_back(waitTime);
responseTimeCM.push_back(responseTime);
slowDownCM.push_back(slowDown);
boundedSlowDownCM.push_back(boundedSlowDown);
} else if (row[5].substr(0,3) == "ESB") {
ESB++;
waitTimeESB.push_back(waitTime);
responseTimeESB.push_back(responseTime);
slowDownESB.push_back(slowDown);
boundedSlowDownESB.push_back(boundedSlowDown);
} else if (row[5].substr(0,3) == "DAM") {
DAM++;
waitTimeDAM.push_back(waitTime);
responseTimeDAM.push_back(responseTime);
slowDownDAM.push_back(slowDown);
boundedSlowDownDAM.push_back(boundedSlowDown);
} else {
cout << row[5] << endl;
}
}
}
int computeTime (vector <int> accumulatedTime) {
int total = 0;
for (int i: accumulatedTime)
total += i;
return total;
}
double computeTime (vector <double> accumulatedTime) {
double total = 0;
for (double d: accumulatedTime)
total += d;
return total;
}
void printPartitions (string partition, int numNodes) {
int totalWaitTime = 0, totalResponseTime = 0, numJobs = 0;
double totalSlowDown = 0, totalBoundedSlowDown = 0;
cout << "##### Partition " << partition << " - " << numNodes << " nodes - ";
if (partition == "CM") {
totalWaitTime = computeTime(waitTimeCM);
totalResponseTime = computeTime(responseTimeCM);
totalSlowDown = computeTime(slowDownCM);
totalBoundedSlowDown = computeTime(boundedSlowDownCM);
numJobs = CM;
} else if (partition == "ESB") {
totalWaitTime = computeTime(waitTimeESB);
totalResponseTime = computeTime(responseTimeESB);
totalSlowDown = computeTime(slowDownESB);
totalBoundedSlowDown = computeTime(boundedSlowDownESB);
numJobs = ESB;
} else if (partition == "DAM") {
totalWaitTime = computeTime(waitTimeDAM);
totalResponseTime = computeTime(responseTimeDAM);
totalSlowDown = computeTime(slowDownDAM);
totalBoundedSlowDown = computeTime(boundedSlowDownDAM);
numJobs = DAM;
}
cout << numJobs << " jobs #####" << endl;
globalWaitTime += totalWaitTime;
cout << "avgWaitTime: " << totalWaitTime / static_cast <double> (numJobs) << endl;
globalResponseTime += totalResponseTime;
cout << "avgResponseTime: " << totalResponseTime / static_cast <double> (numJobs) << endl;
globalSlowDown += totalSlowDown;
cout << "avgSlowDown: " << totalSlowDown / numJobs << endl;
globalBoundedSlowDown += totalBoundedSlowDown;
cout << "avgBoundedSlowDown: " << totalBoundedSlowDown / numJobs << endl;
}
void printGlobals () {
cout << "##### GLOBAL VALUES #####" << endl;
cout << "Jobs: " << jobs << endl;
cout << "globalWaitTime: " << globalWaitTime / static_cast <double>(jobs) << endl;
cout << "globalResponseTime: " << globalResponseTime / static_cast <double>(jobs) << endl;
cout << "globalSlowDown: " << globalSlowDown / static_cast <double>(jobs) << endl;
cout << "globalBoundedSlowDown: " << globalBoundedSlowDown / static_cast <double>(jobs) << endl;
}
int main (int argc, char** argv) {
ifstream input;
ofstream output;
if (argc < 2) {
printf("use: parser tracefile > output\n");
exit(0);
}
input.open(argv[1]);
output.open(argv[2]);
if (input.is_open()) {
parseFile(&input,&output);
input.close();
output.close();
}
else {
cout << "Unable to open file %s" << argv[1] << endl;
exit(-1);
}
// CM - 50 nodes
printPartitions("CM",50);
printPartitions("ESB",150);
printPartitions("DAM",25);
printGlobals();
exit(0);
}
| [
"renan.fischeresilva@bsc.es"
] | renan.fischeresilva@bsc.es |
3107f85966d29ace932ef12c6d867b6e265e34b5 | dd6147bf9433298a64bbceb7fdccaa4cc477fba6 | /8304/Altukhov/lab4-7/Memento.cpp | bc649905a13d678b4907c651c495824d6ae7484b | [] | no_license | moevm/oop | 64a89677879341a3e8e91ba6d719ab598dcabb49 | faffa7e14003b13c658ccf8853d6189b51ee30e6 | refs/heads/master | 2023-03-16T15:48:35.226647 | 2020-06-08T16:16:31 | 2020-06-08T16:16:31 | 85,785,460 | 42 | 304 | null | 2023-03-06T23:46:08 | 2017-03-22T04:37:01 | C++ | WINDOWS-1251 | C++ | false | false | 3,174 | cpp | #include "Memento.h"
void Memento::getInfoFromBase(Base* base, bool myTurn)
{
Memento* mem = const_cast<Memento*>(this);
base->fillMemento(mem, myTurn);
}
void Memento::getInfoFromField(Field* field)
{
Memento* mem = const_cast<Memento*>(this);
field->fillMemento(mem);
}
void Memento::saveToFile(std::string& fileName) {
std::ofstream file(fileName);
file << whatPlayerTurn << " " << fieldW << " " << fieldH << " " << (fieldW*fieldH) << std::endl;
for (int i = 0; i < tiles.size(); i++) {
file << tiles[i].x << " " << tiles[i].y << " " << tiles[i].type << " " << tiles[i].typeNeutral << " " << tiles[i].capturedBy << std::endl;
}
file << hp1 << " " << money1 << " " << turn1 << " " << units1.size() << std::endl;
for (int i = 0; i < units1.size(); i++) {
file << units1[i].x << " " << units1[i].y << " " << units1[i].type << " " << units1[i].level << " " << units1[i].hp << " " << units1[i].canMove << " " << units1[i].canAttack << std::endl;
}
file << hp2 << " " << money2 << " " << turn2 << " " << units2.size() << std::endl;
for (int i = 0; i < units2.size(); i++) {
file << units2[i].x << " " << units2[i].y << " " << units2[i].type << " " << units2[i].level << " " << units2[i].hp << " " << units2[i].canMove << " " << units2[i].canAttack << std::endl;
}
file.close();
}
bool Memento::loadFromFile(Field* field, Base* myBase, Base* otherBase, std::string& fileName) {
std::ifstream file(fileName);
if (!file) {
return false;
}
int check = 0;
file >> whatPlayerTurn >> fieldW >> fieldH >> check;
if (check != fieldW * fieldH) {
//ошибка
return false;
}
tiles.clear();
for (int i = 0; i < check; i++) {
int x, y, type, typeN, capt = 0;
file >> x >> y >> type >> typeN >> capt;
if (x >= fieldW || y >= fieldH || type < 1 || type >3 || typeN < 0 || typeN > 4 || capt < 0 || capt > 2) {
//ошибка
return false;
}
tiles.push_back({ x, y, type, typeN, capt });
}
file >> hp1 >> money1 >> turn1 >> check;
units1.clear();
for (int i = 0; i < check; i++) {
int x, y, type, level, hp, canMove, canAttack;
file >> x >> y >> type >> level >> hp >> canMove >> canAttack;
if (x >= fieldW || y >= fieldH || type < 1 || type >3 || level < 1 || level > 2 ) {
//ошибка
return false;
}
units1.push_back({ x, y, type, level, hp, canMove, canAttack });
}
file >> hp2 >> money2 >> turn2 >> check;
units2.clear();
for (int i = 0; i < check; i++) {
int x, y, type, level, hp, canMove, canAttack;
file >> x >> y >> type >> level >> hp >> canMove >> canAttack;
if (x >= fieldW || y >= fieldH || type < 1 || type >3 || level < 1 || level > 2) {
//ошибка
return false;
}
units2.push_back({ x, y, type, level, hp, canMove, canAttack });
}
myBase->deleteUnits();
otherBase->deleteUnits();
loadInfoToField(field);
loadInfoToBase(myBase, myBase->getPlayer());
loadInfoToBase(otherBase, otherBase->getPlayer());
return true;
}
void Memento::loadInfoToField(Field* field) {
Memento* mem = const_cast<Memento*>(this);
field->newField(mem);
}
void Memento::loadInfoToBase(Base* base, int num) {
Memento* mem = const_cast<Memento*>(this);
base->newBase(mem, num);
}
| [
"alexandr-altukhov2013@yandex.ru"
] | alexandr-altukhov2013@yandex.ru |
a84b6fdb51c8bd11b3829b12dadd726fe0057aec | 3438e8c139a5833836a91140af412311aebf9e86 | /services/ui/service.cc | c7190433b8f67aaf9d4b768cf0a7a06558d76d98 | [
"BSD-3-Clause"
] | permissive | Exstream-OpenSource/Chromium | 345b4336b2fbc1d5609ac5a67dbf361812b84f54 | 718ca933938a85c6d5548c5fad97ea7ca1128751 | refs/heads/master | 2022-12-21T20:07:40.786370 | 2016-10-18T04:53:43 | 2016-10-18T04:53:43 | 71,210,435 | 0 | 2 | BSD-3-Clause | 2022-12-18T12:14:22 | 2016-10-18T04:58:13 | null | UTF-8 | C++ | false | false | 13,988 | cc | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/service.h"
#include <set>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/catalog/public/cpp/resource_loader.h"
#include "services/service_manager/public/c/main.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/tracing/public/cpp/provider.h"
#include "services/ui/clipboard/clipboard_impl.h"
#include "services/ui/common/switches.h"
#include "services/ui/display/platform_screen.h"
#include "services/ui/ime/ime_registrar_impl.h"
#include "services/ui/ime/ime_server_impl.h"
#include "services/ui/ws/accessibility_manager.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/gpu_service_proxy.h"
#include "services/ui/ws/user_activity_monitor.h"
#include "services/ui/ws/user_display_manager.h"
#include "services/ui/ws/window_server.h"
#include "services/ui/ws/window_server_test_impl.h"
#include "services/ui/ws/window_tree.h"
#include "services/ui/ws/window_tree_binding.h"
#include "services/ui/ws/window_tree_factory.h"
#include "services/ui/ws/window_tree_host_factory.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "ui/events/event_switches.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gl/gl_surface.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
#include "ui/platform_window/x11/x11_window.h"
#elif defined(USE_OZONE)
#include "ui/events/ozone/layout/keyboard_layout_engine.h"
#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
#include "ui/ozone/public/ozone_platform.h"
#endif
using service_manager::Connection;
using mojo::InterfaceRequest;
using ui::mojom::WindowServerTest;
using ui::mojom::WindowTreeHostFactory;
namespace ui {
namespace {
const char kResourceFileStrings[] = "mus_app_resources_strings.pak";
const char kResourceFile100[] = "mus_app_resources_100.pak";
const char kResourceFile200[] = "mus_app_resources_200.pak";
} // namespace
// TODO(sky): this is a pretty typical pattern, make it easier to do.
struct Service::PendingRequest {
service_manager::Identity remote_identity;
std::unique_ptr<mojom::WindowTreeFactoryRequest> wtf_request;
std::unique_ptr<mojom::DisplayManagerRequest> dm_request;
};
struct Service::UserState {
std::unique_ptr<clipboard::ClipboardImpl> clipboard;
std::unique_ptr<ws::AccessibilityManager> accessibility;
std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory;
};
Service::Service()
: test_config_(false),
platform_screen_(display::PlatformScreen::Create()),
ime_registrar_(&ime_server_) {}
Service::~Service() {
// Destroy |window_server_| first, since it depends on |event_source_|.
// WindowServer (or more correctly its Displays) may have state that needs to
// be destroyed before GpuState as well.
window_server_.reset();
}
void Service::InitializeResources(service_manager::Connector* connector) {
if (ui::ResourceBundle::HasSharedInstance())
return;
std::set<std::string> resource_paths;
resource_paths.insert(kResourceFileStrings);
resource_paths.insert(kResourceFile100);
resource_paths.insert(kResourceFile200);
catalog::ResourceLoader loader;
filesystem::mojom::DirectoryPtr directory;
connector->ConnectToInterface("service:catalog", &directory);
CHECK(loader.OpenFiles(std::move(directory), resource_paths));
ui::RegisterPathProvider();
// Initialize resource bundle with 1x and 2x cursor bitmaps.
ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
loader.TakeFile(kResourceFileStrings),
base::MemoryMappedFile::Region::kWholeFile);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100),
ui::SCALE_FACTOR_100P);
rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200),
ui::SCALE_FACTOR_200P);
}
Service::UserState* Service::GetUserState(
const service_manager::Identity& remote_identity) {
const ws::UserId& user_id = remote_identity.user_id();
auto it = user_id_to_user_state_.find(user_id);
if (it != user_id_to_user_state_.end())
return it->second.get();
user_id_to_user_state_[user_id] = base::WrapUnique(new UserState);
return user_id_to_user_state_[user_id].get();
}
void Service::AddUserIfNecessary(
const service_manager::Identity& remote_identity) {
window_server_->user_id_tracker()->AddUserId(remote_identity.user_id());
}
void Service::OnStart(const service_manager::Identity& identity) {
base::PlatformThread::SetName("mus");
tracing_.Initialize(connector(), identity.name());
TRACE_EVENT0("mus", "Service::Initialize started");
test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseTestConfig);
#if defined(USE_X11)
XInitThreads();
if (test_config_)
ui::test::SetUseOverrideRedirectWindowByDefault(true);
#endif
InitializeResources(connector());
#if defined(USE_OZONE)
// The ozone platform can provide its own event source. So initialize the
// platform before creating the default event source.
// Because GL libraries need to be initialized before entering the sandbox,
// in MUS, |InitializeForUI| will load the GL libraries.
ui::OzonePlatform::InitParams params;
params.connector = connector();
params.single_process = false;
ui::OzonePlatform::InitializeForUI(params);
// TODO(kylechar): We might not always want a US keyboard layout.
ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()
->SetCurrentLayoutByName("us");
client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create();
ui::ClientNativePixmapFactory::SetInstance(
client_native_pixmap_factory_.get());
DCHECK(ui::ClientNativePixmapFactory::GetInstance());
#endif
// TODO(rjkroege): Enter sandbox here before we start threads in GpuState
// http://crbug.com/584532
#if !defined(OS_ANDROID)
event_source_ = ui::PlatformEventSource::CreateDefault();
#endif
// This needs to happen after DeviceDataManager has been constructed. That
// happens either during OzonePlatform or PlatformEventSource initialization,
// so keep this line below both of those.
input_device_server_.RegisterAsObserver();
// Gpu must be running before the PlatformScreen can be initialized.
window_server_.reset(new ws::WindowServer(this));
// DeviceDataManager must be initialized before TouchController. On non-Linux
// platforms there is no DeviceDataManager so don't create touch controller.
if (ui::DeviceDataManager::HasInstance())
touch_controller_.reset(
new ws::TouchController(window_server_->display_manager()));
ime_server_.Init(connector());
}
bool Service::OnConnect(const service_manager::Identity& remote_identity,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mojom::AccessibilityManager>(this);
registry->AddInterface<mojom::Clipboard>(this);
registry->AddInterface<mojom::DisplayManager>(this);
registry->AddInterface<mojom::GpuService>(this);
registry->AddInterface<mojom::IMERegistrar>(this);
registry->AddInterface<mojom::IMEServer>(this);
registry->AddInterface<mojom::UserAccessManager>(this);
registry->AddInterface<mojom::UserActivityMonitor>(this);
registry->AddInterface<WindowTreeHostFactory>(this);
registry->AddInterface<mojom::WindowManagerWindowTreeFactory>(this);
registry->AddInterface<mojom::WindowTreeFactory>(this);
if (test_config_)
registry->AddInterface<WindowServerTest>(this);
// On non-Linux platforms there will be no DeviceDataManager instance and no
// purpose in adding the Mojo interface to connect to.
if (input_device_server_.IsRegisteredAsObserver())
input_device_server_.AddInterface(registry);
platform_screen_->AddInterfaces(registry);
#if defined(USE_OZONE)
ui::OzonePlatform::GetInstance()->AddInterfaces(registry);
#endif
return true;
}
void Service::OnFirstDisplayReady() {
PendingRequests requests;
requests.swap(pending_requests_);
for (auto& request : requests) {
if (request->wtf_request)
Create(request->remote_identity, std::move(*request->wtf_request));
else
Create(request->remote_identity, std::move(*request->dm_request));
}
}
void Service::OnNoMoreDisplays() {
// We may get here from the destructor, in which case there is no messageloop.
if (base::MessageLoop::current() &&
base::MessageLoop::current()->is_running()) {
base::MessageLoop::current()->QuitWhenIdle();
}
}
bool Service::IsTestConfig() const {
return test_config_;
}
void Service::UpdateTouchTransforms() {
if (touch_controller_)
touch_controller_->UpdateTouchTransforms();
}
void Service::CreateDefaultDisplays() {
// The display manager will create Displays once hardware or virtual displays
// are ready.
platform_screen_->Init(window_server_->display_manager());
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::AccessibilityManagerRequest request) {
UserState* user_state = GetUserState(remote_identity);
if (!user_state->accessibility) {
const ws::UserId& user_id = remote_identity.user_id();
user_state->accessibility.reset(
new ws::AccessibilityManager(window_server_.get(), user_id));
}
user_state->accessibility->Bind(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::ClipboardRequest request) {
UserState* user_state = GetUserState(remote_identity);
if (!user_state->clipboard)
user_state->clipboard.reset(new clipboard::ClipboardImpl);
user_state->clipboard->AddBinding(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::DisplayManagerRequest request) {
// DisplayManagerObservers generally expect there to be at least one display.
if (!window_server_->display_manager()->has_displays()) {
std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
pending_request->remote_identity = remote_identity;
pending_request->dm_request.reset(
new mojom::DisplayManagerRequest(std::move(request)));
pending_requests_.push_back(std::move(pending_request));
return;
}
window_server_->display_manager()
->GetUserDisplayManager(remote_identity.user_id())
->AddDisplayManagerBinding(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::GpuServiceRequest request) {
window_server_->gpu_proxy()->Add(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::IMERegistrarRequest request) {
ime_registrar_.AddBinding(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::IMEServerRequest request) {
ime_server_.AddBinding(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::UserAccessManagerRequest request) {
window_server_->user_id_tracker()->Bind(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::UserActivityMonitorRequest request) {
AddUserIfNecessary(remote_identity);
const ws::UserId& user_id = remote_identity.user_id();
window_server_->GetUserActivityMonitorForUser(user_id)->Add(
std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::WindowManagerWindowTreeFactoryRequest request) {
AddUserIfNecessary(remote_identity);
window_server_->window_manager_window_tree_factory_set()->Add(
remote_identity.user_id(), std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::WindowTreeFactoryRequest request) {
AddUserIfNecessary(remote_identity);
if (!window_server_->display_manager()->has_displays()) {
std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
pending_request->remote_identity = remote_identity;
pending_request->wtf_request.reset(
new mojom::WindowTreeFactoryRequest(std::move(request)));
pending_requests_.push_back(std::move(pending_request));
return;
}
AddUserIfNecessary(remote_identity);
mojo::MakeStrongBinding(base::MakeUnique<ws::WindowTreeFactory>(
window_server_.get(), remote_identity.user_id(),
remote_identity.name()),
std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::WindowTreeHostFactoryRequest request) {
UserState* user_state = GetUserState(remote_identity);
if (!user_state->window_tree_host_factory) {
user_state->window_tree_host_factory.reset(new ws::WindowTreeHostFactory(
window_server_.get(), remote_identity.user_id()));
}
user_state->window_tree_host_factory->AddBinding(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
mojom::WindowServerTestRequest request) {
if (!test_config_)
return;
mojo::MakeStrongBinding(
base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()),
std::move(request));
}
} // namespace ui
| [
"support@opentext.com"
] | support@opentext.com |
ac6bf760161fe2edfbc7435a2b973adefd730b4e | 8042163dbac5ddf47f078b4d14f4eb6fe1da030d | /tensorflow/compiler/mlir/xla/transforms/lhlo_legalize_to_gpu.cc | f0eb3cc1a0fd3032d7fea8e3288ff6d2de299a44 | [
"Apache-2.0"
] | permissive | AITutorials/tensorflow | 4513de8db4e9bb74b784f5ba865ef8a573b9efc1 | 6bee0d45f8228f2498f53bd6dec0a691f53b3c7b | refs/heads/master | 2022-07-29T13:37:23.749388 | 2020-06-11T17:47:26 | 2020-06-11T17:57:06 | 271,615,051 | 3 | 0 | Apache-2.0 | 2020-06-11T18:07:11 | 2020-06-11T18:07:10 | null | UTF-8 | C++ | false | false | 8,407 | cc | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// This file implements logic for lowering LHLO dialect to GPU dialect.
#include <cstdint>
#include "absl/memory/memory.h"
#include "llvm/ADT/ArrayRef.h"
#include "mlir/Dialect/GPU/GPUDialect.h" // from @llvm-project
#include "mlir/Dialect/Linalg/IR/LinalgOps.h" // from @llvm-project
#include "mlir/Dialect/SCF/SCF.h" // from @llvm-project
#include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project
#include "mlir/IR/Attributes.h" // from @llvm-project
#include "mlir/IR/BlockAndValueMapping.h" // from @llvm-project
#include "mlir/IR/Builders.h" // from @llvm-project
#include "mlir/IR/Function.h" // from @llvm-project
#include "mlir/IR/Location.h" // from @llvm-project
#include "mlir/IR/MLIRContext.h" // from @llvm-project
#include "mlir/IR/Operation.h" // from @llvm-project
#include "mlir/IR/PatternMatch.h" // from @llvm-project
#include "mlir/IR/StandardTypes.h" // from @llvm-project
#include "mlir/Pass/Pass.h" // from @llvm-project
#include "mlir/Transforms/DialectConversion.h" // from @llvm-project
#include "tensorflow/compiler/mlir/xla/ir/lhlo_ops.h"
#include "tensorflow/compiler/mlir/xla/transforms/map_xla_to_scalar_op.h"
namespace mlir {
namespace xla_lhlo {
namespace {
// A simple translation of LHLO reduce operations to a corresponding gpu
// launch operation. The transformation does no tiling and also only supports
// 1d results.
class LhloReduceToGPULaunchConverter : public OpConversionPattern<ReduceOp> {
public:
using OpConversionPattern::OpConversionPattern;
LogicalResult matchAndRewrite(
ReduceOp reduce_op, ArrayRef<Value> args,
ConversionPatternRewriter& rewriter) const final {
auto loc = reduce_op.getLoc();
// Only support 1d reductions for now.
int64_t size = 0;
for (auto result : reduce_op.out()) {
auto shaped_type = result.getType().dyn_cast<ShapedType>();
if (!shaped_type || shaped_type.getRank() != 1) {
return failure();
}
auto dim_size = shaped_type.getDimSize(0);
if (size && size != dim_size) {
return failure();
}
size = dim_size;
}
auto reducing_dimension = *reduce_op.dimensions().int_value_begin();
// Require all inputs to have the same shape.
int64_t reduce_dim_size = 0;
for (auto input : reduce_op.operands()) {
auto shaped_type = input.getType().dyn_cast<ShapedType>();
if (!shaped_type || !shaped_type.hasStaticShape()) {
return failure();
}
reduce_dim_size =
shaped_type.getDimSize(reducing_dimension.getSExtValue());
}
// Create a launch that is parallel in the result dimension.
auto block_size_x = rewriter.create<mlir::ConstantOp>(
loc, rewriter.getIndexType(),
rewriter.getIntegerAttr(rewriter.getIndexType(), size));
auto one = rewriter.create<mlir::ConstantOp>(
loc, rewriter.getIndexType(),
rewriter.getIntegerAttr(rewriter.getIndexType(), 1));
auto launch_op = rewriter.create<mlir::gpu::LaunchOp>(
loc, one, one, one, block_size_x, one, one);
{
OpBuilder::InsertionGuard guard(rewriter);
rewriter.setInsertionPointToEnd(&launch_op.body().front());
auto index = launch_op.getThreadIds().x;
// Load the initial value and store it to the output.
for (auto pair : llvm::zip(reduce_op.init_values(), reduce_op.out())) {
auto init_value = rewriter.create<mlir::LoadOp>(loc, std::get<0>(pair));
rewriter.create<mlir::StoreOp>(loc, init_value, std::get<1>(pair),
ArrayRef<Value>{index});
}
// Insert a loop into the body to compute the reduction. The loop ranges
// from [0.dim).
auto zero = rewriter.create<mlir::ConstantOp>(
loc, rewriter.getIndexType(),
rewriter.getIntegerAttr(rewriter.getIndexType(), 0));
// TODO(b/137624192) Use dimOp to make it shape independent.
auto upper = rewriter.create<mlir::ConstantOp>(
loc, rewriter.getIndexType(),
rewriter.getIntegerAttr(rewriter.getIndexType(), reduce_dim_size));
auto step = rewriter.create<mlir::ConstantOp>(
loc, rewriter.getIndexType(),
rewriter.getIntegerAttr(rewriter.getIndexType(), 1));
auto loop = rewriter.create<mlir::scf::ForOp>(loc, zero, upper, step);
rewriter.setInsertionPointToStart(loop.getBody());
// Compute memrefs for the value to reduce. This makes it easier to just
// inline the body.
auto output = *reduce_op.out().begin();
// TODO(herhut) Move this to the SliceOp builder.
auto resType = MemRefType::get(
llvm::None, output.getType().cast<MemRefType>().getElementType(),
makeStridedLinearLayoutMap(llvm::None,
MemRefType::getDynamicStrideOrOffset(),
rewriter.getContext()));
auto accumulator = rewriter.create<mlir::linalg::SliceOp>(
loc, resType, output, ArrayRef<Value>{launch_op.getThreadIds().x});
llvm::SmallVector<Value, 4> indexings;
auto input_buffer = *reduce_op.operands().begin();
auto input_type = input_buffer.getType().cast<MemRefType>();
for (int64_t dim = 0; dim < input_type.getRank(); ++dim) {
indexings.push_back(dim == reducing_dimension
? loop.getInductionVar()
: launch_op.getThreadIds().x);
}
// TODO(herhut) Move this to the SliceOp builder.
auto input = *reduce_op.operand_begin();
auto rhs = rewriter.create<mlir::linalg::SliceOp>(
loc,
MemRefType::get(
llvm::None, input_type.getElementType(),
makeStridedLinearLayoutMap(llvm::None,
MemRefType::getDynamicStrideOrOffset(),
rewriter.getContext())),
input, indexings);
// Now copy over the actual body of the reduction, leaving out the
// terminator.
BlockAndValueMapping mapping;
mapping.map(reduce_op.body().front().getArgument(0), accumulator);
mapping.map(reduce_op.body().front().getArgument(1), rhs);
mapping.map(reduce_op.body().front().getArgument(2), accumulator);
for (auto& nested : reduce_op.body().front().without_terminator()) {
auto clone = rewriter.clone(nested, mapping);
for (auto pair : llvm::zip(nested.getResults(), clone->getResults())) {
mapping.map(std::get<0>(pair), std::get<1>(pair));
}
}
// Finally, insert the terminator for the launchOp.
rewriter.setInsertionPointToEnd(&launch_op.body().front());
rewriter.create<mlir::gpu::TerminatorOp>(loc);
}
rewriter.eraseOp(reduce_op);
return success();
};
};
struct LhloLegalizeToGpu : public PassWrapper<LhloLegalizeToGpu, FunctionPass> {
void runOnFunction() override {
OwningRewritePatternList patterns;
ConversionTarget target(getContext());
target.addLegalDialect<linalg::LinalgDialect, StandardOpsDialect,
gpu::GPUDialect, scf::SCFDialect, XlaLhloDialect>();
target.addIllegalOp<ReduceOp>();
auto func = getFunction();
patterns.insert<LhloReduceToGPULaunchConverter>(func.getContext());
if (failed(applyPartialConversion(func, target, patterns, nullptr))) {
signalPassFailure();
}
}
};
} // namespace
std::unique_ptr<OperationPass<FuncOp>> createLegalizeToGpuPass() {
return absl::make_unique<LhloLegalizeToGpu>();
}
static PassRegistration<LhloLegalizeToGpu> legalize_pass(
"lhlo-legalize-to-gpu", "Legalize from LHLO dialect to GPU dialect");
} // namespace xla_lhlo
} // namespace mlir
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
83ae490cdb1628684e1f254bc6d1b16d44ad08dc | edf415acc17ca8e9df0e4ec22a8c2a1f224b9da5 | /MainGame/particles/ParticleBatch.cpp | 37f9e9dd2b37a3f37d21fd70414b924205f978d4 | [
"MIT",
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | JoaoBaptMG/ReboundTheGame | 149fe1d5a509ccc1a21620bed12ce662ce31f102 | 48c3d8b81de1f7fa7c622c3f815860257ccdba8e | refs/heads/master | 2021-01-11T15:18:15.475448 | 2019-09-29T12:55:07 | 2019-09-29T12:55:07 | 80,321,381 | 64 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 8,232 | cpp | //
// Copyright (c) 2016-2018 João Baptista de Paula e Silva.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#include "ParticleBatch.hpp"
#include <random>
#include <functional>
#include "particles/ParticleEmitter.hpp"
#include "rendering/Renderer.hpp"
#include <chronoUtils.hpp>
#include "scene/GameScene.hpp"
#include "resources/ResourceManager.hpp"
#include <assert.hpp>
constexpr auto ParticleVertexShader = R"vertex(
varying float PointSize;
varying vec2 TexCoord;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
PointSize = gl_MultiTexCoord0.y;
float texId = gl_MultiTexCoord0.x;
TexCoord = vec2(mod(texId,2.0), floor(texId/2.0));
gl_FrontColor = gl_Color;
}
)vertex";
constexpr auto ParticleSmoothFragmentShader = R"fragment(
varying vec2 TexCoord;
void main()
{
gl_FragColor = gl_Color;
gl_FragColor.a *= 1.0 - 2.0 * distance(TexCoord, vec2(0.5, 0.5));
}
)fragment";
constexpr auto ParticleDiskFragmentShader = R"fragment(
varying float PointSize;
varying vec2 TexCoord;
void main()
{
gl_FragColor = gl_Color;
gl_FragColor.a *= clamp((1.0 - 2.0 * distance(TexCoord, vec2(0.5, 0.5))) * PointSize, 0.0, 1.0);
}
)fragment";
const char* ParticleFragmentShaders[] = { ParticleSmoothFragmentShader, ParticleDiskFragmentShader };
sf::Shader& ParticleBatch::getParticleShader(ParticleBatch::Style style)
{
static sf::Shader shaders[(size_t)Style::MaxSize];
static bool shadersLoaded[(size_t)Style::MaxSize];
if (!shadersLoaded[(size_t)style])
{
ASSERT(shaders[(size_t)style].loadFromMemory(ParticleVertexShader, ParticleFragmentShaders[(size_t)style]));
shadersLoaded[(size_t)style] = true;
}
return shaders[(size_t)style];
}
static sf::Glsl::Vec4 operator+(sf::Glsl::Vec4 v1, sf::Glsl::Vec4 v2)
{
return sf::Glsl::Vec4(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z, v1.w + v2.w);
}
static sf::Glsl::Vec4 operator-(sf::Glsl::Vec4 v1, sf::Glsl::Vec4 v2)
{
return sf::Glsl::Vec4(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z, v1.w - v2.w);
}
static sf::Glsl::Vec4 operator*(float s, sf::Glsl::Vec4 v2)
{
return sf::Glsl::Vec4(s * v2.x, s * v2.y, s * v2.z, s * v2.w);
}
inline static auto convertDuration(FrameDuration duration)
{
return std::chrono::duration_cast<ParticleBatch::Duration>(duration);
}
inline static auto convertTime(FrameTime time)
{
using namespace std::chrono;
return ParticleBatch::TimePoint(convertDuration(time.time_since_epoch()));
}
ParticleBatch::ParticleBatch(GameScene &scene, std::string emitterSetName, std::string emitterName,
bool persistent, size_t depth)
: GameObject(scene), vertices(sf::Triangles), drawingDepth(depth), aborted(false),
emitterSet(scene.getResourceManager().load<ParticleEmitterSet>(emitterSetName))
{
std::random_device init;
std::mt19937 rgen(init());
std::uniform_real_distribution<float> distribution;
generator = std::bind(distribution, rgen);
isPersistent = persistent;
emitter = &emitterSet->at(emitterName);
}
ParticleBatch::~ParticleBatch()
{
}
void ParticleBatch::addParticle(ParticleBatch::PositionInfo pos,
ParticleBatch::DisplayInfo display,
ParticleBatch::Duration lifetime)
{
pos.position += position;
positionAttributes.push_back(pos);
displayAttributes.push_back(display);
lifeAttributes.push_back({ convertTime(lastTime), convertTime(lastTime) + lifetime, lifetime });
vertices.resize(6*positionAttributes.size());
}
void ParticleBatch::removeParticle(size_t index)
{
using std::swap;
auto last = positionAttributes.size()-1;
swap(positionAttributes[index], positionAttributes[last]);
swap(displayAttributes[index], displayAttributes[last]);
swap(lifeAttributes[index], lifeAttributes[last]);
positionAttributes.pop_back();
displayAttributes.pop_back();
lifeAttributes.pop_back();
vertices.resize(6*positionAttributes.size());
}
void ParticleBatch::update(FrameTime curTime)
{
if (lastTime == decltype(lastTime)()) lastTime = curTime;
if (initialTime == decltype(initialTime)()) initialTime = curTime;
auto dt = toSeconds<float>(curTime - lastTime);
for (auto& data : positionAttributes)
{
data.position += data.velocity * dt;
data.velocity += data.acceleration * dt;
}
for (size_t i = 0; i < displayAttributes.size(); i++)
{
auto& display = displayAttributes[i];
auto& life = lifeAttributes[i];
auto factor = toSeconds<float>(convertTime(curTime) - life.beginTime) / toSeconds<float>(life.lifetime);
if (factor >= 1.0) factor = 1.0;
display.curColor = display.beginColor + factor * (display.endColor - display.beginColor);
display.curSize = display.beginSize + factor * (display.endSize - display.beginSize);
}
for (size_t i = 0; i < lifeAttributes.size(); i++)
if (convertTime(curTime) > lifeAttributes[i].endTime) removeParticle(i);
if (!aborted && curTime - initialTime <= emitter->getTotalLifetime())
emitter->generateNewParticles(*this, convertDuration(curTime - initialTime), convertDuration(lastTime - initialTime));
else if (positionAttributes.empty()) remove();
lastTime = curTime;
}
bool ParticleBatch::notifyScreenTransition(cpVect displacement)
{
for (auto& data : positionAttributes)
data.position += sf::Vector2f(displacement.x, displacement.y);
return true;
}
void ParticleBatch::render(Renderer& renderer)
{
for (size_t i = 0; i < positionAttributes.size(); i++)
{
for (size_t k = 0; k < 6; k++)
{
vertices[6*i+k].position = positionAttributes[i].position;
vertices[6*i+k].color = sf::Color(displayAttributes[i].curColor.x * 255.f,
displayAttributes[i].curColor.y * 255.f,
displayAttributes[i].curColor.z * 255.f,
displayAttributes[i].curColor.w * 255.f);
}
auto curSize = displayAttributes[i].curSize;
vertices[6*i+0].position += sf::Vector2f(-curSize/2, -curSize/2);
vertices[6*i+1].position += sf::Vector2f(+curSize/2, -curSize/2);
vertices[6*i+2].position += sf::Vector2f(+curSize/2, +curSize/2);
vertices[6*i+3].position += sf::Vector2f(-curSize/2, +curSize/2);
vertices[6*i+4].position += sf::Vector2f(-curSize/2, -curSize/2);
vertices[6*i+5].position += sf::Vector2f(+curSize/2, +curSize/2);
vertices[6*i+0].texCoords = sf::Vector2f(0, curSize);
vertices[6*i+1].texCoords = sf::Vector2f(1, curSize);
vertices[6*i+2].texCoords = sf::Vector2f(3, curSize);
vertices[6*i+3].texCoords = sf::Vector2f(2, curSize);
vertices[6*i+4].texCoords = sf::Vector2f(0, curSize);
vertices[6*i+5].texCoords = sf::Vector2f(3, curSize);
}
sf::RenderStates states;
states.blendMode = sf::BlendAlpha;
states.shader = &getParticleShader(emitter->getParticleStyle());
renderer.pushDrawable(vertices, states, drawingDepth);
}
| [
"jbaptistapsilva@yahoo.com.br"
] | jbaptistapsilva@yahoo.com.br |
9b1e6df14e0d731fae1a36f042531c8807d18825 | 3aca856b8a0dbc2c4cb6a4fdd38e6514c95aa437 | /src/world/chunk/Face.hpp | c503aaa2208e6ecdd8bcf83de92d8307509f4acc | [] | no_license | bauhaus93/blocks | 2d612fafe7e7a847c43f0aa78c1b8f2e20dc92f4 | 8b55d79752fd836e3619128169292e67c9281f8f | refs/heads/master | 2021-03-22T04:21:17.198170 | 2018-12-03T18:37:06 | 2018-12-03T18:37:06 | 118,833,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 788 | hpp | /* Copyright 2018 Jakob Fischer <JakobFischer93@gmail.com> */
#pragma once
#include <iostream>
#include <cstdint>
#include "logger/GlobalLogger.hpp"
#include "utility/Point2.hpp"
#include "world/BlockType.hpp"
#include "world/Direction.hpp"
namespace blocks {
class Face {
public:
Face(BlockType type_, Direction dir_, Point2i8 origin_, int8_t size_);
BlockType GetType() const { return type; }
Direction GetDirection() const { return dir; }
const Point2i8& GetOrigin() const { return origin; }
int8_t GetSize() const { return size; }
private:
BlockType type;
Direction dir;
Point2i8 origin;
int8_t size;
};
std::ostream& operator<<(std::ostream& os, const Face& face);
} // namespace blocks
| [
"jakobfischer93@gmail.com"
] | jakobfischer93@gmail.com |
254deb25e454ae02f21158e3a9865548f5d1ee09 | 7bbb435bc5539fd82eb0ae1ae1065cff099606ab | /5SD803_Assignment1_DataStructures_2020_v3/source/binary_search_tree.h | 29b25f583946dce33ae709060772265628fdad7f | [] | no_license | LilithOstrowska/LLandBS | 5a54fa4cea46e503a6a56635b94b9387d02cec1f | 0320630ab14417cedf6c40a5809cf175ccf7b1b6 | refs/heads/main | 2023-01-15T18:43:54.762705 | 2020-11-10T09:03:22 | 2020-11-10T09:03:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,086 | h | // binary_search_tree.h
#ifndef BINARY_SEARCH_TREE_H_INCLUDED
#define BINARY_SEARCH_TREE_H_INCLUDED
#include "linked_list.h"
// note: implementation required for pass
class binary_search_tree
{
binary_search_tree(binary_search_tree &&rhs) = delete;
binary_search_tree(const binary_search_tree &rhs) = delete;
binary_search_tree &operator=(const binary_search_tree &rhs) = delete;
public:
enum class depth_first_algorithm
{
PRE_ORDER,
IN_ORDER,
POST_ORDER,
};
binary_search_tree();
~binary_search_tree();
void insert(int value);
void remove(int value);
void clear();
int size() const;
bool contains(int value);
void depth_first(linked_list &list, const depth_first_algorithm algorithm);
void breath_first(linked_list &list);
private:
struct node
{
node();
explicit node(int value, node *lhs, node *rhs);
int value_;
node *lhs_; // lhs -> left-hand side
node *rhs_; // rhs -> right-hand side
};
int count_;
node *root_;
};
#endif // !BINARY_SEARCH_TREE_H_INCLUDED
| [
"43043232+Dragonborn98760@users.noreply.github.com"
] | 43043232+Dragonborn98760@users.noreply.github.com |
dac68b0884b745579d07583003e4a15b239d2863 | 6b40e9cba1dd06cd31a289adff90e9ea622387ac | /Develop/Server/GameServerOck/main/GMessageID.h | ece378b40f088afcf33f0b799bd97e41853e0585 | [] | no_license | AmesianX/SHZPublicDev | c70a84f9170438256bc9b2a4d397d22c9c0e1fb9 | 0f53e3b94a34cef1bc32a06c80730b0d8afaef7d | refs/heads/master | 2022-02-09T07:34:44.339038 | 2014-06-09T09:20:04 | 2014-06-09T09:20:04 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 3,728 | h | #ifndef _GMESSAGE_ID_H
#define _GMESSAGE_ID_H
#include "GDef.h"
class GLuaResult;
class GEntityPlayer;
/// 메세지 ID
enum GMessageID
{
GMSG_UNKNOWN = 0,
// AI에서 사용하는 이벤트
GMSG_AI_EVT_THINK, ///< 뭔가 주위상황이 바뀌어졌을 때 AI가 뭔가 다음 액션을 취하기를 원할때 발생
GMSG_AI_EVT_TRY_ATTACKED, ///< 공격을 시도 당했다.
GMSG_AI_EVT_ATTACK, ///< 공격했다.
GMSG_AI_EVT_ATTACKED, ///< 공격당했다.
GMSG_AI_EVT_ARRIVED, ///< 목표로 하는 지점에 도착했다.
GMSG_AI_EVT_BLOCKED, ///< 더이상 이동할 수 없다.
GMSG_AI_EVT_DEAD, ///< 죽었다
GMSG_AI_EVT_FORGET_TARGET, ///< 타겟을 잃어버렸다
GMSG_AI_EVT_FIND_TARGET, ///< 타겟 발견
GMSG_AI_EVT_LISTEN, ///< 소리를 들었다
GMSG_AI_EVT_YELL, ///< 동료의 원조 요청
GMSG_AI_EVT_HATETABLECHANGED, ///< 헤이트 테이블 값이 바뀌었다.
GMSG_AI_EVT_STARTCOMBAT, ///< 전투 시작
GMSG_AI_EVT_ENDCOMBAT, ///< 전투 종료
GMSG_AI_EVT_FLEE, ///< 도망 칠때
GMSG_AI_EVT_ENDPROLOGUE, ///< 전투 초기 상태 종료
GMSG_AI_EVT_START_VICTORY, ///< 승리 상태 시작
GMSG_AI_EVT_GRABBED, ///< 잡혔을 때
GMSG_AI_EVT_CHANGETARGET, ///< 타겟이 바뀌었을 때
GMSG_AI_EVT_ATTACKTURN, ///< 매 공격가능시점에서
GMSG_AI_EVT_PEACE, ///< Peace 상태로 전이
GMSG_AI_EVT_SESSION, ///< Session 상태로 전이
GMSG_AI_EVT_SESSION_CHANGE_SCENE, ///< 세션 씬 변경
GMSG_AI_EVT_SESSION_PUSHJOB, ///< 세션잡 추가
GMSG_AI_EVT_SESSION_FINISHED, ///< 세션종료
GMSG_AI_EVT_JOB_CLEAR, ///< JobMgr 초기화
GMSG_AI_EVT_JOB_COMPLETED, ///< JobMgr에서 잡이 성공적으로 완료
GMSG_AI_EVT_JOB_CANCELED, ///< JobMgr에서 잡이 취소
GMSG_AI_EVT_JOB_TIMEDOUT, ///< JobMgr에서 잡이 시간만료
GMSG_AI_EVT_JOB_FINISHED, ///< JobMgr에서 잡이 완료 (Finished, Canceld 모두)
GMSG_AI_EVT_MISSION, ///< 미션 잡이 추가 되었다.
// 스킬 관련
GMSGL_HIT_TALENT, ///< 스킬에 맞았다
GMSG_MAX
};
static const wchar_t* GMessageIDStr[GMSG_MAX] =
{
L"GMSG_UNKNOWN",
L"GMSG_AI_EVT_THINK",
L"GMSG_AI_EVT_TRY_ATTACKED",
L"GMSG_AI_EVT_ATTACK",
L"GMSG_AI_EVT_ATTACKED",
L"GMSG_AI_EVT_ARRIVED",
L"GMSG_AI_EVT_BLOCKED",
L"GMSG_AI_EVT_DEAD",
L"GMSG_AI_EVT_FORGET_TARGET",
L"GMSG_AI_EVT_FIND_TARGET",
L"GMSG_AI_EVT_LISTEN",
L"GMSG_AI_EVT_YELL",
L"GMSG_AI_EVT_HATETABLECHANGED",
L"GMSG_AI_EVT_STARTCOMBAT",
L"GMSG_AI_EVT_ENDCOMBAT",
L"GMSG_AI_EVT_FLEE",
L"GMSG_AI_EVT_START_VICTORY",
L"GMSG_AI_EVT_GRABBED",
L"GMSG_AI_EVT_CHANGETARGET",
L"GMSG_AI_EVT_ATTACKTURN",
L"GMSG_AI_EVT_PEACE",
L"GMSG_AI_EVT_MISSION",
L"GMSGL_HIT_TALENT",
};
// 메세지 파라메타
struct EVENT_ATTACKED_INFO
{
EVENT_ATTACKED_INFO()
: uidAttacker(MUID::ZERO)
, nType(DA_NONE)
, nDamage(0)
, nEffectSourceType(EST_NONE)
, nEffectSourceID(INVALID_ID)
{
}
MUID uidAttacker;
DAMAGE_ATTRIB nType;
uint32 nDamage;
EFFECT_SOURCE_TYPE nEffectSourceType;
int nEffectSourceID;
};
struct EVENT_ATTACK_INFO
{
MUID uidTarget;
uint32 nDamage;
};
struct EVENT_FOUND_ENEMY
{
MUID uidTarget;
};
struct EVENT_DIALOG_EXIT
{
GEntityPlayer* pPlayer;
int nDialogID;
int nExit;
};
struct EVENT_YELL_INFO
{
MUID uidSender;
MUID uidTarget;
};
struct EVENT_START_COMBAT
{
MUID uidEnemy;
};
struct EVENT_FLEE_INFO
{
FleeType nFleeType;
float fDurationTime;
EVENT_FLEE_INFO()
: fDurationTime(0.0f)
, nFleeType(Flee_FromEnemy)
{
}
};
#endif
| [
"shzdev@8fd9ef21-cdc5-48af-8625-ea2f38c673c4"
] | shzdev@8fd9ef21-cdc5-48af-8625-ea2f38c673c4 |
d8a46af3c20e691f793f314a6b0470ed83249629 | 92ba72fb43edf46f1942491d2e43851482c32cb0 | /zyy/104.cpp | 36c85714389d54b144fb08c73454ead84c58cdd5 | [] | no_license | iujaypuppy/LeetCode | 53f7cabf2c5c4b2f8d4d857987313254d965e447 | 3072f7b4f9847dc2d8a1830acb140ad5fd807188 | refs/heads/master | 2020-06-27T22:30:13.413558 | 2017-12-01T01:21:39 | 2017-12-01T01:21:39 | 97,072,879 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 670 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void maxDepthRecursive(TreeNode *root, int level, int &max) {
if (root == NULL) {
if (level > max) {
max = level;
}
return;
}
maxDepthRecursive(root->left, level + 1, max);
maxDepthRecursive(root->right, level + 1, max);
}
int maxDepth(TreeNode* root) {
int result;
maxDepthRecursive(root, 0, result);
return result;
}
};
| [
"tomsun.0.7@gmail.com"
] | tomsun.0.7@gmail.com |
724819a6fdf520b8180e107bdfdf0da27bc9eabe | 8177a677bb39dd60f3a6f1f5219aa556647eeebf | /src/multiplicative_mistake_slack_window/multiplicative_mistake_slack_window.cpp | 707a4244faa194748904a4f5da0519385954db0a | [] | no_license | gilikarni/Summing | 30b0258e45c01a08f9170f2ff6b46fd0bdfda0db | a6c8e5f5d8a6668ad495b183ae1407316d638819 | refs/heads/master | 2021-01-20T14:22:29.457927 | 2017-08-31T06:27:36 | 2017-08-31T06:28:10 | 90,594,517 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,881 | cpp | /* Includes: */
#include "multiplicative_mistake_slack_window.h"
#include <cmath>
#include "../utils.h"
/* Namespace: */
/* Macros: */
#define minus_inf -1
/* Globals */
std::ofstream MultiplicativeMistakeSlackSumming_outputFile;
/* Constructors: */
MultiplicativeMistakeSlackSumming::MultiplicativeMistakeSlackSumming(
const uint64_t& _range,
const uint64_t& _window,
const double& _tau,
const double& _epsilon) :
range(_range), window(_window), sum(0), tau(_tau),
epsilon(_epsilon), lastElements(0),
elements((int)ceil(1/_tau), 0), diff(0)
{
MultiplicativeMistakeSlackSumming_outputFile.open(
OUTPUT_FILE_NAME,
std::ofstream::out | std::ofstream::app);
if (!MultiplicativeMistakeSlackSumming_outputFile ||
!MultiplicativeMistakeSlackSumming_outputFile.good())
{
std::cout << "Could not open " << OUTPUT_FILE_NAME << " in "
<< __FILE__ << std::endl;
throw std::bad_alloc();
}
blockSize = (uint64_t)round((double(window)*tau));
if (0 == blockSize)
{
printLogsToFile(MultiplicativeMistakeSlackSumming_outputFile,
"ERROR: tau is too small!");
throw std::bad_alloc();
}
}
/* Destructors */
MultiplicativeMistakeSlackSumming::~MultiplicativeMistakeSlackSumming()
{
MultiplicativeMistakeSlackSumming_outputFile.close();
}
/* Static functions: */
/*
* Function name: calcRo
*
* Description:
* Calculate ro according to the essay.
*
* Parameters:
* epsilon - The allowed mistake in the sum
* y - the sum of the elements in the last block.
*
* Return values:
* ro
*/
static double calcRo(const double& epsilon, const double& y)
{
if (0 == y)
{
return minus_inf;
}
double ro = log(y) / log (1 + epsilon/2);
return floor(ro);
}
/*
* Function name: roundDown
*
* Description:
* Calculate round down according to the essay.
*
* Parameters:
* epsilon - The allowed mistake in the sum
* x - the number to round
*
* Return values:
* the rounded result
*/
static double roundDown(const double& epsilon, const double& ro)
{
double x = 0;
if (minus_inf != ro)
{
x = pow(1.0 + epsilon/2.0, ro);
}
double k = ceil(4/epsilon);
return floor(x * k)/k;
}
/* API: */
/*
* Function name: MultiplicativeMistakeSlackSumming::update
*
* Description:
* Update the sum of the sliding window.
*
* Parameters:
* packatSize - The size of the new element
*
* Return values:
* None
*/
void MultiplicativeMistakeSlackSumming::update(const uint16_t& packetSize)
{
static unsigned int counter = 0;
lastElements += packetSize;
diff++;
if (diff == blockSize)
{
double ro = calcRo(epsilon, (double)lastElements);
if (counter < window / blockSize)
{
counter++;
sum += roundDown(epsilon, ro);
}
else
{
sum += roundDown(epsilon, ro) - roundDown(epsilon, elements.back());
}
elements.pop_back();
elements.insert(elements.begin(), ro);
lastElements = 0;
diff = 0;
}
}
/*
* Function name: MultiplicativeMistakeSlackSumming::query
*
* Description:
* Return the sum of the last "window" elements
*
* Parameters:
* windowSizeMistake - output. The difference between the size of the
* window that was summed and w.
*
* Return values:
* The sum of the last "window" + windowSizeMistake elements
*/
double MultiplicativeMistakeSlackSumming::query(uint64_t& windowSizeMistake) const
{
windowSizeMistake = diff;
return sum + lastElements;
}
/*
* Function name: MultiplicativeMistakeSlackSumming::getSize
*
* Description:
* Return the size of the object MultiplicativeMistakeSlackSumming
*
* Parameters:
* None
*
* Return values:
* The size of the object
*/
uint64_t MultiplicativeMistakeSlackSumming::getSize() const
{
return sizeof(range) + sizeof(window) + sizeof(sum) + sizeof(tau) +
sizeof(epsilon) + sizeof(lastElements) + sizeof(elements) +
elements.size() * sizeof(double) + sizeof(diff) + sizeof(blockSize);
}
| [
"gilikarni@campus.technion.ac.il"
] | gilikarni@campus.technion.ac.il |
4471b04a07db3cfdb629f6df6bcffb1cab3d0a4b | b1af8bb863a6730e6e4e93129efbad89d33cf509 | /SDK/SCUM_Geek_Goggels_functions.cpp | eb6e37e20285b6437d8fc71d517f2af4b87084ea | [] | no_license | frankie-11/SCUM_SDK7.13.2020 | b3bbd8fb9b6c03120b865a6254eca6a2389ea654 | 7b48bcf9e8088aa8917c07dd6756eac90e3f693a | refs/heads/master | 2022-11-16T05:48:55.729087 | 2020-07-13T23:48:50 | 2020-07-13T23:48:50 | 279,433,512 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,086 | cpp | // SCUM (4.24) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "../SDK.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function ConZ.ClothesItem.UpdateMaterialParamsOnClients
// ()
void AGeek_Goggels_C::UpdateMaterialParamsOnClients()
{
static auto fn = UObject::FindObject<UFunction>("Function ConZ.ClothesItem.UpdateMaterialParamsOnClients");
AGeek_Goggels_C_UpdateMaterialParamsOnClients_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function ConZ.ClothesItem.SetDirtiness
// ()
// Parameters:
// float* dirtiness (Parm, ZeroConstructor, IsPlainOldData)
void AGeek_Goggels_C::SetDirtiness(float* dirtiness)
{
static auto fn = UObject::FindObject<UFunction>("Function ConZ.ClothesItem.SetDirtiness");
AGeek_Goggels_C_SetDirtiness_Params params;
params.dirtiness = dirtiness;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function ConZ.ClothesItem.OnRep_MaterialParameters
// ()
void AGeek_Goggels_C::OnRep_MaterialParameters()
{
static auto fn = UObject::FindObject<UFunction>("Function ConZ.ClothesItem.OnRep_MaterialParameters");
AGeek_Goggels_C_OnRep_MaterialParameters_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function ConZ.ClothesItem.GetWarmth
// ()
// Parameters:
// int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
int AGeek_Goggels_C::GetWarmth()
{
static auto fn = UObject::FindObject<UFunction>("Function ConZ.ClothesItem.GetWarmth");
AGeek_Goggels_C_GetWarmth_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function ConZ.ClothesItem.GetCapacityY
// ()
// Parameters:
// int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
int AGeek_Goggels_C::GetCapacityY()
{
static auto fn = UObject::FindObject<UFunction>("Function ConZ.ClothesItem.GetCapacityY");
AGeek_Goggels_C_GetCapacityY_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function ConZ.ClothesItem.GetCapacityX
// ()
// Parameters:
// int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
int AGeek_Goggels_C::GetCapacityX()
{
static auto fn = UObject::FindObject<UFunction>("Function ConZ.ClothesItem.GetCapacityX");
AGeek_Goggels_C_GetCapacityX_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"60810131+frankie-11@users.noreply.github.com"
] | 60810131+frankie-11@users.noreply.github.com |
5789517c34ebe81c4b5ba038c38363e84fe4c2f7 | fcad81ce487257da992904a7547c7df68ac854ca | /bulk/detail/cuda_launcher/parameter_ptr.hpp | ca7f781aae6818d5127126bcb84cc4e660796599 | [] | no_license | jaredhoberock/bulk | efcccc0dc5d335d26e4b9296c08daa9f4443f71b | e31eedaf7a44bd0841d7f41bcb73e0fc11544aa1 | refs/heads/master | 2020-04-06T07:12:38.072648 | 2019-10-04T13:48:57 | 2019-10-04T13:48:57 | 10,181,786 | 31 | 6 | null | 2019-10-04T13:48:58 | 2013-05-20T20:55:45 | C++ | UTF-8 | C++ | false | false | 2,770 | hpp | /*
* Copyright 2008-2013 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <bulk/detail/config.hpp>
#include <bulk/detail/guarded_cuda_runtime_api.hpp>
#include <bulk/detail/throw_on_error.hpp>
#include <bulk/detail/terminate.hpp>
#include <thrust/detail/swap.h>
#include <cstring>
BULK_NAMESPACE_PREFIX
namespace bulk
{
namespace detail
{
// this thing has ownership semantics like unique_ptr, so copy and assign are more like moves
template<typename T>
class parameter_ptr
{
public:
typedef T element_type;
__host__ __device__
explicit parameter_ptr(element_type *ptr)
: m_ptr(ptr)
{}
// XXX copy emulates a move
__host__ __device__
parameter_ptr(const parameter_ptr& other_)
{
parameter_ptr& other = const_cast<parameter_ptr&>(other_);
thrust::swap(m_ptr, other.m_ptr);
}
__host__ __device__
~parameter_ptr()
{
#if __BULK_HAS_CUDART__
if(m_ptr)
{
bulk::detail::terminate_on_error(cudaFree(m_ptr), "in parameter_ptr dtor");
}
#else
bulk::detail::terminate_with_message("parameter_ptr dtor: cudaFree requires CUDART");
#endif
}
// XXX assign emulates a move
__host__ __device__
parameter_ptr& operator=(const parameter_ptr& other_)
{
parameter_ptr& other = const_cast<parameter_ptr&>(other_);
thrust::swap(m_ptr, other.m_ptr);
return *this;
}
__host__ __device__
T* get() const
{
return m_ptr;
}
private:
T *m_ptr;
};
template<typename T>
__host__ __device__
parameter_ptr<T> make_parameter(const T& x)
{
T* raw_ptr = 0;
// allocate
#if __BULK_HAS_CUDART__
bulk::detail::throw_on_error(cudaMalloc(&raw_ptr, sizeof(T)), "make_parameter(): after cudaMalloc");
#else
bulk::detail::terminate_with_message("make_parameter(): cudaMalloc requires CUDART\n");
#endif
// do a trivial copy
#ifndef __CUDA_ARCH__
bulk::detail::throw_on_error(cudaMemcpy(raw_ptr, &x, sizeof(T), cudaMemcpyHostToDevice),
"make_parameter(): after cudaMemcpy");
#else
std::memcpy(raw_ptr, &x, sizeof(T));
#endif
return parameter_ptr<T>(raw_ptr);
}
} // end detail
} // end bulk
BULK_NAMESPACE_SUFFIX
| [
"jaredhoberock@gmail.com"
] | jaredhoberock@gmail.com |
de4380312180bee09442227d137f15bb51abdf47 | eea5f4d19b56fca79621af2f2854854eab405780 | /libraries/SFE_MMA8452Q/SFE_MMA8452Q.h | 3131bd244b52582c5458d0838725b9d8060daba7 | [] | no_license | lingjiekong/TeambarqArduino | 26bbd96e305a30c2c20288707eb618cd6ab129c9 | 39d951a42ce8351d6f6ff67090b37ec547fda603 | refs/heads/master | 2016-09-12T18:36:14.239358 | 2016-06-01T22:15:05 | 2016-06-01T22:15:05 | 58,331,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,148 | h | /******************************************************************************
SFE_MMA8452Q.h
SFE_MMA8452Q Library Header File
Jim Lindblom @ SparkFun Electronics
Original Creation Date: June 3, 2014
https://github.com/sparkfun/MMA8452_Accelerometer
This file prototypes the MMA8452Q class, implemented in SFE_MMA8452Q.cpp. In
addition, it defines every register in the MMA8452Q.
Development environment specifics:
IDE: Arduino 1.0.5
Hardware Platform: Arduino Uno
This code is beerware; if you see me (or any other SparkFun employee) at the
local, and you've found our code helpful, please buy us a round!
Distributed as-is; no warranty is given.
******************************************************************************/
#ifndef SFE_MMA8452Q_h
#define SFE_MMA8452Q_h
#include <Arduino.h>
///////////////////////////////////
// MMA8452Q Register Definitions //
///////////////////////////////////
enum MMA8452Q_Register {
STATUS_M = 0x00,
OUT_X_MSB = 0x01,
OUT_X_LSB = 0x02,
OUT_Y_MSB = 0x03,
OUT_Y_LSB = 0x04,
OUT_Z_MSB = 0x05,
OUT_Z_LSB = 0x06,
SYSMOD = 0x0B,
INT_SOURCE = 0x0C,
WHO_AM_I = 0x0D,
XYZ_DATA_CFG = 0x0E,
HP_FILTER_CUTOFF = 0x0F,
PL_STATUS = 0x10,
PL_CFG = 0x11,
PL_COUNT = 0x12,
PL_BF_ZCOMP = 0x13,
P_L_THS_REG = 0x14,
FF_MT_CFG = 0x15,
FF_MT_SRC = 0x16,
FF_MT_THS = 0x17,
FF_MT_COUNT = 0x18,
TRANSIENT_CFG = 0x1D,
TRANSIENT_SRC = 0x1E,
TRANSIENT_THS = 0x1F,
TRANSIENT_COUNT = 0x20,
PULSE_CFG = 0x21,
PULSE_SRC = 0x22,
PULSE_THSX = 0x23,
PULSE_THSY = 0x24,
PULSE_THSZ = 0x25,
PULSE_TMLT = 0x26,
PULSE_LTCY = 0x27,
PULSE_WIND = 0x28,
ASLP_COUNT = 0x29,
CTRL_REG1 = 0x2A,
CTRL_REG2 = 0x2B,
CTRL_REG3 = 0x2C,
CTRL_REG4 = 0x2D,
CTRL_REG5 = 0x2E,
OFF_X = 0x2F,
OFF_Y = 0x30,
OFF_Z = 0x31
};
////////////////////////////////
// MMA8452Q Misc Declarations //
////////////////////////////////
enum MMA8452Q_Scale {SCALE_2G = 2, SCALE_4G = 4, SCALE_8G = 8}; // Possible full-scale settings
enum MMA8452Q_ODR {ODR_800, ODR_400, ODR_200, ODR_100, ODR_50, ODR_12, ODR_6, ODR_1}; // possible data rates
// Possible portrait/landscape settings
#define PORTRAIT_U 0
#define PORTRAIT_D 1
#define LANDSCAPE_R 2
#define LANDSCAPE_L 3
#define LOCKOUT 0x40
////////////////////////////////
// MMA8452Q Class Declaration //
////////////////////////////////
class MMA8452Q
{
public:
MMA8452Q(byte addr = 0x1D); // Constructor
byte init(MMA8452Q_Scale fsr = SCALE_2G, MMA8452Q_ODR odr = ODR_800);
void read();
byte available();
byte readTap();
byte readPL();
int x, y, z;
float cx, cy, cz;
private:
byte address;
MMA8452Q_Scale scale;
void standby();
void active();
void setupPL();
void setupTap(byte xThs, byte yThs, byte zThs);
void setScale(MMA8452Q_Scale fsr);
void setODR(MMA8452Q_ODR odr);
void writeRegister(MMA8452Q_Register reg, byte data);
void writeRegisters(MMA8452Q_Register reg, byte *buffer, byte len);
byte readRegister(MMA8452Q_Register reg);
void readRegisters(MMA8452Q_Register reg, byte *buffer, byte len);
};
#endif | [
"konglingjie.007@gmail.com"
] | konglingjie.007@gmail.com |
bad1b39b6483d426398213218c33ee19ecf402bd | 1cb31fed8f65ea398429f69a1e88243395a1da8b | /include/ama/tensor/index.hpp | c4182fc495803d89665abfcfe25831aa3126b76d | [] | no_license | mattiapenati/amanita | 6ac5a9b85591ed00f07bc61c9eeaed1fa7ab2fe8 | c5c16d1f17e71151ce1d8e6972ddff6cec3c7305 | refs/heads/master | 2021-01-23T07:03:01.958404 | 2011-02-20T20:30:19 | 2011-02-20T20:30:19 | 240,369,107 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,786 | hpp | /*
* Copyright (c) 2011, Mattia Penati <mattia.penati@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the Politecnico di Milano nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AMA_TENSOR_INDEX_HPP
#define AMA_TENSOR_INDEX_HPP 1
namespace ama
{
template <char I> struct index { };
}
#endif /* AMA_TENSOR_INDEX_HPP */
| [
"mattia.penati@localhost"
] | mattia.penati@localhost |
a22f68f87dfeef1f2f0a3ebbee8c9287621535bf | fbf65dd3bc2030496d990519ff3b9582201aa5b6 | /src/Integrator/WhittedIntegrator.h | a4a5adec26b580d9d2ebdb48ded949772013eb27 | [] | no_license | CXUtk/CrystalEngine | 1ae871011ec37345811a57b95309c05013fc28e6 | cc72ab0a57c99a3e2c6255df83b30bb6132677e4 | refs/heads/master | 2023-04-21T23:11:27.314475 | 2021-05-10T18:31:21 | 2021-05-10T18:31:21 | 339,526,716 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 684 | h | #pragma once
#include "SamplerIntegrator.h"
#include <Utils/Random.h>
#include "Textures/CubemapTexture.h"
class WhittedIntegrator : public SamplerIntegrator {
public:
WhittedIntegrator(std::shared_ptr<Camera> camera, std::shared_ptr<Sampler> sampler, std::shared_ptr<CubemapTexture> skybox, int maxDepth);
~WhittedIntegrator() override;
glm::vec3 Evaluate(const Ray& ray, std::shared_ptr<const Scene> scene) override;
private:
Random _random;
int _maxDepth;
glm::vec3 evaluate(const Ray& ray, std::shared_ptr<const Scene> scene, int depth);
glm::vec3 emitted(const SurfaceInteraction& isec, const Object* object, glm::vec3 wOut, glm::vec3 dir);
};
| [
"2237367067@qq.com"
] | 2237367067@qq.com |
ae8177b2be8538cb75449ecb8182eae0b6845d2e | f8a5d7afd88afb58420d213f4968df8e7feed36e | /BinarySearchTree/Source.cpp | 6e00c345b070c6dfc50b409908889c3c19db1bca | [] | no_license | lnwpeach/cpp-BinarySearchTree | 24400a8967ac31f1a2efb248c67934871eedf243 | 2753a5a283d0f99064475780b8fc502791652a43 | refs/heads/master | 2023-01-20T16:28:46.931543 | 2020-11-27T09:38:50 | 2020-11-27T09:38:50 | 316,458,856 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,177 | cpp | #include "Header.h"
string line(50, '=');
int menu();
int menuPrint();
int menuFind();
int main(){
BinarySearchTree<int> a(-999);
int ch ,ch2 ,ch3 , element, find;
do {
ch = menu();
if (ch == 1) {
cout << "Enter Element : ";
cin >> element;
a.insert(element);
}
else if (ch == 2) {
ch2 = menuPrint();
cout << line << endl;
if (ch2 == 1) {
cout << " Binary Search Tree (Preorder) : ";
a.printPre();
}
else if (ch2 == 2) {
cout << " Binary Search Tree (Inorder) : ";
a.printTree();
}
else if (ch2 == 3) {
cout << " Binary Search Tree (Postorder) : ";
a.printPost();
}
cout << endl << line << endl;
// system("pause");
}
else if (ch == 3) {
do {
ch3 = menuFind();
if (ch3 == 1) {
cout << "Enter Element : ";
cin >> element;
find = a.find(element);
cout << line << endl;
if (find == -999)
cout << "\t---- Data not found ----" << endl;
else
cout << "\t" << find << " is element of Binary Search Tree" << endl;
cout << line << endl;
// system("pause");
}
else if (ch3 == 2) {
find = a.findMin();
cout << line << endl;
if (find == -999)
cout << "\t---- Data not found ----" << endl;
else
cout << "\t" << find << " is min element of Binary Search Tree" << endl;
cout << line << endl;
// system("pause");
}
else if (ch3 == 3) {
find = a.findMax();
cout << line << endl;
if (find == -999)
cout << "\t---- Data not found ----" << endl;
else
cout << "\t" << find << " is max element of Binary Search Tree" << endl;
cout << line << endl;
// system("pause");
}
} while (ch3 != 4);
}
else if (ch == 4) {
cout << "Enter Element : ";
cin >> element;
find = a.find(element);
cout << line << endl;
if (find == -999)
cout << "\t---- Data not found ----" << endl;
else {
a.remove(element);
cout << "\t Remove " << element << " Success" << endl;
}
cout << line << endl;
// system("pause");
}
} while (ch != 5);
return 0;
}
int menu() {
int ch;
// system("cls");
cout << line << endl;
cout << "\tAssignment Binary Search Tree" << endl;
cout << line << endl;
cout << " 1. Insert" << endl;
cout << " 2. PrintTree" << endl;
cout << " 3. Find" << endl;
cout << " 4. Remove" << endl;
cout << " 5. Quit" << endl;
cout << line << endl;
cout << "Enter choice : ";
cin >> ch;
return ch;
}
int menuPrint() {
int ch;
cout << line << endl;
cout << " 1. Preorder" << endl;
cout << " 2. Inorder" << endl;
cout << " 3. Postorder" << endl;
cout << line << endl;
cout << "Enter choice : ";
cin >> ch;
return ch;
}
int menuFind() {
int ch;
// system("cls");
cout << line << endl;
cout << "\t\tFind Menu" << endl;
cout << line << endl;
cout << " 1. Find Element" << endl;
cout << " 2. Find Min" << endl;
cout << " 3. Find Max" << endl;
cout << " 4. Back to Mainmenu" << endl;
cout << line << endl;
cout << "Enter choice : ";
cin >> ch;
return ch;
} | [
"pichayuth.c@gmail.com"
] | pichayuth.c@gmail.com |
f354a7f05156c050c080017f82f110a37f63ae38 | 77a1e8b6e3181b097a196bda951ae5ed05115729 | /libraries/wasm-jit/Include/WAST/WAST.h | 92ed856800cc44e0900c2ba222b311b60504688b | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | yinchengtsinghua/EOSIOChineseCPP | 04888f80cb7a946fb54c2494137868cb86685ff1 | dceabf6315ab8c9a064c76e943b2b44037165a85 | refs/heads/master | 2020-04-18T01:20:58.685186 | 2019-01-23T04:17:07 | 2019-01-23T04:17:07 | 167,115,462 | 21 | 11 | null | null | null | null | UTF-8 | C++ | false | false | 1,424 | h |
//此源码被清华学神尹成大魔王专业翻译分析并修改
//尹成QQ77025077
//尹成微信18510341407
//尹成所在QQ群721929980
//尹成邮箱 yinc13@mails.tsinghua.edu.cn
//尹成毕业于清华大学,微软区块链领域全球最有价值专家
//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
#pragma once
#ifndef WAST_API
#define WAST_API DLL_IMPORT
#endif
#include "Inline/BasicTypes.h"
#include "Runtime/Runtime.h"
#include "WASM/WASM.h"
namespace WAST
{
//文本文件中的位置。
struct TextFileLocus
{
std::string sourceLine;
U32 newlines;
U32 tabs;
U32 characters;
TextFileLocus(): newlines(0), tabs(0), characters(0) {}
U32 lineNumber() const { return newlines + 1; }
U32 column(U32 spacesPerTab = 4) const { return tabs * spacesPerTab + characters + 1; }
std::string describe(U32 spacesPerTab = 4) const
{
return std::to_string(lineNumber()) + ":" + std::to_string(column(spacesPerTab));
}
};
//WAST分析错误。
struct Error
{
TextFileLocus locus;
std::string message;
};
//从字符串分析模块。如果成功,则返回true,并将模块写入outmodule。
//如果失败,则返回false并将错误列表追加到outErrors。
WAST_API bool parseModule(const char* string,Uptr stringLength,IR::Module& outModule,std::vector<Error>& outErrors);
//以WAST格式打印模块。
WAST_API std::string print(const IR::Module& module);
} | [
"openaichain"
] | openaichain |
56f8a339ab15c0c51695a40e749b464ec8ca7827 | 168d3b8de78c0dbc02a3ed14697de71669b4fa45 | /ga/module/encoder-x264/encoder-x264.cpp | ef346c01df232ed0c2d8d0140a6158c3e2518030 | [] | no_license | hush-z/gaminganywhere | 7ea410967f0d1661dd89b7945a4cf60da5c1634e | 78959501c6185fa4dbf29c54db96d3df9e63c478 | refs/heads/master | 2021-01-15T18:08:33.150280 | 2015-06-25T01:41:58 | 2015-06-25T01:41:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,890 | cpp | /*
* Copyright (c) 2013-2014 Chun-Ying Huang
*
* This file is part of GamingAnywhere (GA).
*
* GA is free software; you can redistribute it and/or modify it
* under the terms of the 3-clause BSD License as published by the
* Free Software Foundation: http://directory.fsf.org/wiki/License:BSD_3Clause
*
* GA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the 3-clause BSD License along with GA;
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
#include "vsource.h"
#include "rtspconf.h"
#include "encoder-common.h"
#include "ga-common.h"
#include "ga-avcodec.h"
#include "ga-conf.h"
#include "ga-module.h"
#include "dpipe.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <x264.h>
#ifdef __cplusplus
}
#endif
static struct RTSPConf *rtspconf = NULL;
static int vencoder_initialized = 0;
static int vencoder_started = 0;
static pthread_t vencoder_tid[VIDEO_SOURCE_CHANNEL_MAX];
static pthread_mutex_t vencoder_reconf_mutex[VIDEO_SOURCE_CHANNEL_MAX];
static ga_ioctl_reconfigure_t vencoder_reconf[VIDEO_SOURCE_CHANNEL_MAX];
//// encoders for encoding
static x264_t* vencoder[VIDEO_SOURCE_CHANNEL_MAX];
// specific data for h.264
static char *_sps[VIDEO_SOURCE_CHANNEL_MAX];
static int _spslen[VIDEO_SOURCE_CHANNEL_MAX];
static char *_pps[VIDEO_SOURCE_CHANNEL_MAX];
static int _ppslen[VIDEO_SOURCE_CHANNEL_MAX];
//#define SAVEENC "save.264"
#ifdef SAVEENC
static FILE *fsaveenc = NULL;
#endif
static int
vencoder_deinit(void *arg) {
int iid;
#ifdef SAVEENC
if(fsaveenc != NULL) {
fclose(fsaveenc);
fsaveenc = NULL;
}
#endif
for(iid = 0; iid < video_source_channels(); iid++) {
if(_sps[iid] != NULL)
free(_sps[iid]);
if(_pps[iid] != NULL)
free(_pps[iid]);
if(vencoder[iid] != NULL)
x264_encoder_close(vencoder[iid]);
pthread_mutex_destroy(&vencoder_reconf_mutex[iid]);
vencoder[iid] = NULL;
}
bzero(_sps, sizeof(_sps));
bzero(_pps, sizeof(_pps));
bzero(_spslen, sizeof(_spslen));
bzero(_ppslen, sizeof(_ppslen));
vencoder_initialized = 0;
ga_error("video encoder: deinitialized.\n");
return 0;
}
static int /* XXX: we need this because many GA config values are in bits, not Kbits */
ga_x264_param_parse_bit(x264_param_t *params, const char *name, const char *bitvalue) {
int v = strtol(bitvalue, NULL, 0);
char kbit[64];
snprintf(kbit, sizeof(kbit), "%d", v / 1000);
return x264_param_parse(params, name, kbit);
}
static int
vencoder_init(void *arg) {
int iid;
char *pipefmt = (char*) arg;
struct RTSPConf *rtspconf = rtspconf_global();
char profile[16], preset[16], tune[16];
char x264params[1024];
char tmpbuf[64];
//
if(rtspconf == NULL) {
ga_error("video encoder: no configuration found\n");
return -1;
}
if(vencoder_initialized != 0)
return 0;
//
for(iid = 0; iid < video_source_channels(); iid++) {
char pipename[64];
int outputW, outputH;
dpipe_t *pipe;
x264_param_t params;
//
_sps[iid] = _pps[iid] = NULL;
_spslen[iid] = _ppslen[iid] = 0;
pthread_mutex_init(&vencoder_reconf_mutex[iid], NULL);
vencoder_reconf[iid].id = -1;
//
snprintf(pipename, sizeof(pipename), pipefmt, iid);
outputW = video_source_out_width(iid);
outputH = video_source_out_height(iid);
if(outputW % 4 != 0 || outputH % 4 != 0) {
ga_error("video encoder: unsupported resolutin %dx%d\n", outputW, outputH);
goto init_failed;
}
if((pipe = dpipe_lookup(pipename)) == NULL) {
ga_error("video encoder: pipe %s is not found\n", pipename);
goto init_failed;
}
ga_error("video encoder: video source #%d from '%s' (%dx%d).\n",
iid, pipe->name, outputW, outputH, iid);
//
bzero(¶ms, sizeof(params));
x264_param_default(¶ms);
// fill params
preset[0] = tune[0] = '\0';
ga_conf_mapreadv("video-specific", "preset", preset, sizeof(preset));
ga_conf_mapreadv("video-specific", "tune", tune, sizeof(tune));
if(preset[0] != '\0' || tune[0] != '\0') {
if(x264_param_default_preset(¶ms, preset, tune) < 0) {
ga_error("video encoder: bad x264 preset=%s; tune=%s\n", preset, tune);
goto init_failed;
} else {
ga_error("video encoder: x264 preset=%s; tune=%s\n", preset, tune);
}
}
//
if(ga_conf_mapreadv("video-specific", "b", tmpbuf, sizeof(tmpbuf)) != NULL)
ga_x264_param_parse_bit(¶ms, "bitrate", tmpbuf);
if(ga_conf_mapreadv("video-specific", "crf", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "crf", tmpbuf);
if(ga_conf_mapreadv("video-specific", "vbv-init", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "vbv-init", tmpbuf);
if(ga_conf_mapreadv("video-specific", "maxrate", tmpbuf, sizeof(tmpbuf)) != NULL)
ga_x264_param_parse_bit(¶ms, "vbv-maxrate", tmpbuf);
if(ga_conf_mapreadv("video-specific", "bufsize", tmpbuf, sizeof(tmpbuf)) != NULL)
ga_x264_param_parse_bit(¶ms, "vbv-bufsize", tmpbuf);
if(ga_conf_mapreadv("video-specific", "refs", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "ref", tmpbuf);
if(ga_conf_mapreadv("video-specific", "me_method", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "me", tmpbuf);
if(ga_conf_mapreadv("video-specific", "me_range", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "merange", tmpbuf);
if(ga_conf_mapreadv("video-specific", "g", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "keyint", tmpbuf);
if(ga_conf_mapreadv("video-specific", "intra-refresh", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "intra-refresh", tmpbuf);
//
x264_param_parse(¶ms, "bframes", "0");
x264_param_apply_fastfirstpass(¶ms);
if(ga_conf_mapreadv("video-specific", "profile", profile, sizeof(profile)) != NULL) {
if(x264_param_apply_profile(¶ms, profile) < 0) {
ga_error("video encoder: x264 - bad profile %s\n", profile);
goto init_failed;
}
}
//
if(ga_conf_readv("video-fps", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "fps", tmpbuf);
if(ga_conf_mapreadv("video-specific", "threads", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "threads", tmpbuf);
if(ga_conf_mapreadv("video-specific", "slices", tmpbuf, sizeof(tmpbuf)) != NULL)
x264_param_parse(¶ms, "slices", tmpbuf);
//
params.i_log_level = X264_LOG_INFO;
params.i_csp = X264_CSP_I420;
params.i_width = outputW;
params.i_height = outputH;
params.vui.b_fullrange = 1;
params.b_repeat_headers = 1;
params.b_annexb = 1;
// handle x264-params
if(ga_conf_mapreadv("video-specific", "x264-params", x264params, sizeof(x264params)) != NULL) {
char *saveptr, *value;
char *name = strtok_r(x264params, ":", &saveptr);
while(name != NULL) {
if((value = strchr(name, '=')) != NULL) {
*value++ = '\0';
}
if(x264_param_parse(¶ms, name, value) < 0) {
ga_error("video encoder: warning - bad x264 param [%s=%s]\n", name, value);
}
name = strtok_r(NULL, ":", &saveptr);
}
}
//
vencoder[iid] = x264_encoder_open(¶ms);
if(vencoder[iid] == NULL)
goto init_failed;
ga_error("video encoder: opened! bitrate=%dKbps; me_method=%d; me_range=%d; refs=%d; g=%d; intra-refresh=%d; width=%d; height=%d; crop=%d,%d,%d,%d; threads=%d; slices=%d; repeat-hdr=%d; annexb=%d\n",
params.rc.i_bitrate,
params.analyse.i_me_method, params.analyse.i_me_range,
params.i_frame_reference,
params.i_keyint_max,
params.b_intra_refresh,
params.i_width, params.i_height,
params.crop_rect.i_left, params.crop_rect.i_top,
params.crop_rect.i_right, params.crop_rect.i_bottom,
params.i_threads, params.i_slice_count,
params.b_repeat_headers, params.b_annexb);
}
#ifdef SAVEENC
fsaveenc = fopen(SAVEENC, "wb");
#endif
vencoder_initialized = 1;
ga_error("video encoder: initialized.\n");
return 0;
init_failed:
vencoder_deinit(NULL);
return -1;
}
static int
vencoder_reconfigure(int iid) {
int ret = 0;
x264_param_t params;
x264_t *encoder = vencoder[iid];
ga_ioctl_reconfigure_t *reconf = &vencoder_reconf[iid];
//
pthread_mutex_lock(&vencoder_reconf_mutex[iid]);
if(vencoder_reconf[iid].id >= 0) {
int doit = 0;
x264_encoder_parameters(encoder, ¶ms);
//
if(reconf->crf > 0) {
params.rc.f_rf_constant = 1.0 * reconf->crf;
doit++;
}
if(reconf->framerate_n > 0) {
params.i_fps_num = reconf->framerate_n;
params.i_fps_den = reconf->framerate_d > 0 ? reconf->framerate_d : 1;
doit++;
}
if(reconf->bitrateKbps > 0) {
// XXX: do not use x264_param_parse("bitrate"), it switches mode to ABR
// - although mode switching may be not allowed
params.rc.i_bitrate = reconf->bitrateKbps;
params.rc.i_vbv_max_bitrate = reconf->bitrateKbps;
doit++;
}
if(reconf->bufsize > 0) {
params.rc.i_vbv_buffer_size = reconf->bufsize;
doit++;
}
//
if(doit > 0) {
if(x264_encoder_reconfig(encoder, ¶ms) < 0) {
ga_error("video encoder: reconfigure failed. crf=%d; framerate=%d/%d; bitrate=%d; bufsize=%d.\n",
reconf->crf,
reconf->framerate_n, reconf->framerate_d,
reconf->bitrateKbps,
reconf->bufsize);
ret = -1;
} else {
ga_error("video encoder: reconfigured. crf=%.2f; framerate=%d/%d; bitrate=%d/%dKbps; bufsize=%dKbit.\n",
params.rc.f_rf_constant,
params.i_fps_num, params.i_fps_den,
params.rc.i_bitrate, params.rc.i_vbv_max_bitrate,
params.rc.i_vbv_buffer_size);
}
}
reconf->id = -1;
}
pthread_mutex_unlock(&vencoder_reconf_mutex[iid]);
return ret;
}
static void *
vencoder_threadproc(void *arg) {
// arg is pointer to source pipename
int iid, outputW, outputH;
vsource_frame_t *frame = NULL;
char *pipename = (char*) arg;
dpipe_t *pipe = dpipe_lookup(pipename);
dpipe_buffer_t *data = NULL;
x264_t *encoder = NULL;
//
long long basePts = -1LL, newpts = 0LL, pts = -1LL, ptsSync = 0LL;
pthread_mutex_t condMutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
//
unsigned char *pktbuf = NULL;
int pktbufsize = 0, pktbufmax = 0;
int video_written = 0;
int64_t x264_pts = 0;
//
if(pipe == NULL) {
ga_error("video encoder: invalid pipeline specified (%s).\n", pipename);
goto video_quit;
}
//
rtspconf = rtspconf_global();
// init variables
iid = pipe->channel_id;
encoder = vencoder[iid];
//
outputW = video_source_out_width(iid);
outputH = video_source_out_height(iid);
pktbufmax = outputW * outputH * 2;
if((pktbuf = (unsigned char*) malloc(pktbufmax)) == NULL) {
ga_error("video encoder: allocate memory failed.\n");
goto video_quit;
}
// start encoding
ga_error("video encoding started: tid=%ld %dx%d@%dfps.\n",
ga_gettid(),
outputW, outputH, rtspconf->video_fps);
//
while(vencoder_started != 0 && encoder_running() > 0) {
x264_picture_t pic_in, pic_out = {0};
x264_nal_t *nal;
int i, size, nnal;
struct timeval tv;
struct timespec to;
gettimeofday(&tv, NULL);
// need reconfigure?
vencoder_reconfigure(iid);
// wait for notification
to.tv_sec = tv.tv_sec+1;
to.tv_nsec = tv.tv_usec * 1000;
data = dpipe_load(pipe, &to);
if(data == NULL) {
ga_error("viedo encoder: image source timed out.\n");
continue;
}
frame = (vsource_frame_t*) data->pointer;
// handle pts
if(basePts == -1LL) {
basePts = frame->imgpts;
ptsSync = encoder_pts_sync(rtspconf->video_fps);
newpts = ptsSync;
} else {
newpts = ptsSync + frame->imgpts - basePts;
}
//
x264_picture_init(&pic_in);
//
pic_in.img.i_csp = X264_CSP_I420;
pic_in.img.i_plane = 3;
pic_in.img.i_stride[0] = frame->linesize[0];
pic_in.img.i_stride[1] = frame->linesize[1];
pic_in.img.i_stride[2] = frame->linesize[2];
pic_in.img.plane[0] = frame->imgbuf;
pic_in.img.plane[1] = pic_in.img.plane[0] + outputW*outputH;
pic_in.img.plane[2] = pic_in.img.plane[1] + ((outputW * outputH) >> 2);
// pts must be monotonically increasing
if(newpts > pts) {
pts = newpts;
} else {
pts++;
}
//pic_in.i_pts = pts;
pic_in.i_pts = x264_pts++;
// encode
if((size = x264_encoder_encode(encoder, &nal, &nnal, &pic_in, &pic_out)) < 0) {
ga_error("video encoder: encode failed, err = %d\n", size);
dpipe_put(pipe, data);
break;
}
dpipe_put(pipe, data);
// encode
if(size > 0) {
AVPacket pkt;
#if 1
av_init_packet(&pkt);
pkt.pts = pic_in.i_pts;
pkt.stream_index = 0;
// concatenate nals
pktbufsize = 0;
for(i = 0; i < nnal; i++) {
if(pktbufsize + nal[i].i_payload > pktbufmax) {
ga_error("video encoder: nal dropped (%d < %d).\n", i+1, nnal);
break;
}
bcopy(nal[i].p_payload, pktbuf + pktbufsize, nal[i].i_payload);
pktbufsize += nal[i].i_payload;
}
pkt.size = pktbufsize;
pkt.data = pktbuf;
#if 0 // XXX: dump naltype
do {
int codelen;
unsigned char *ptr;
fprintf(stderr, "[XXX-naldump]");
for( ptr = ga_find_startcode(pkt.data, pkt.data+pkt.size, &codelen);
ptr != NULL;
ptr = ga_find_startcode(ptr+codelen, pkt.data+pkt.size, &codelen)) {
//
fprintf(stderr, " (+%d|%d)-%02x", ptr-pkt.data, codelen, ptr[codelen] & 0x1f);
}
fprintf(stderr, "\n");
} while(0);
#endif
// send the packet
if(encoder_send_packet("video-encoder",
iid/*rtspconf->video_id*/, &pkt,
pkt.pts, NULL) < 0) {
goto video_quit;
}
#ifdef SAVEENC
if(fsaveenc != NULL)
fwrite(pkt.data, sizeof(char), pkt.size, fsaveenc);
#endif
#else
// handling special nals (type > 5)
for(i = 0; i < nnal; i++) {
unsigned char *ptr;
int offset;
if((ptr = ga_find_startcode(nal[i].p_payload, nal[i].p_payload + nal[i].i_payload, &offset))
!= nal[i].p_payload) {
ga_error("video encoder: no startcode found for nals\n");
goto video_quit;
}
if((*(ptr+offset) & 0x1f) <= 5)
break;
av_init_packet(&pkt);
pkt.pts = pic_in.i_pts;
pkt.stream_index = 0;
pkt.size = nal[i].i_payload;
pkt.data = ptr;
if(encoder_send_packet("video-encoder",
iid/*rtspconf->video_id*/, &pkt, pkt.pts, NULL) < 0) {
goto video_quit;
}
#ifdef SAVEENC
if(fsaveenc != NULL)
fwrite(pkt.data, sizeof(char), pkt.size, fsaveenc);
#endif
}
// handling video frame data
pktbufsize = 0;
for(; i < nnal; i++) {
if(pktbufsize + nal[i].i_payload > pktbufmax) {
ga_error("video encoder: nal dropped (%d < %d).\n", i+1, nnal);
break;
}
bcopy(nal[i].p_payload, pktbuf + pktbufsize, nal[i].i_payload);
pktbufsize += nal[i].i_payload;
}
if(pktbufsize > 0) {
av_init_packet(&pkt);
pkt.pts = pic_in.i_pts;
pkt.stream_index = 0;
pkt.size = pktbufsize;
pkt.data = pktbuf;
if(encoder_send_packet("video-encoder",
iid/*rtspconf->video_id*/, &pkt, pkt.pts, NULL) < 0) {
goto video_quit;
}
#ifdef SAVEENC
if(fsaveenc != NULL)
fwrite(pkt.data, sizeof(char), pkt.size, fsaveenc);
#endif
}
#endif
// free unused side-data
if(pkt.side_data_elems > 0) {
int i;
for (i = 0; i < pkt.side_data_elems; i++)
av_free(pkt.side_data[i].data);
av_freep(&pkt.side_data);
pkt.side_data_elems = 0;
}
//
if(video_written == 0) {
video_written = 1;
ga_error("first video frame written (pts=%lld)\n", pic_in.i_pts);
}
}
}
//
video_quit:
if(pipe) {
pipe = NULL;
}
if(pktbuf != NULL) {
free(pktbuf);
}
pktbuf = NULL;
//
ga_error("video encoder: thread terminated (tid=%ld).\n", ga_gettid());
//
return NULL;
}
static int
vencoder_start(void *arg) {
int iid;
char *pipefmt = (char*) arg;
#define MAXPARAMLEN 64
static char pipename[VIDEO_SOURCE_CHANNEL_MAX][MAXPARAMLEN];
if(vencoder_started != 0)
return 0;
vencoder_started = 1;
for(iid = 0; iid < video_source_channels(); iid++) {
snprintf(pipename[iid], MAXPARAMLEN, pipefmt, iid);
if(pthread_create(&vencoder_tid[iid], NULL, vencoder_threadproc, pipename[iid]) != 0) {
vencoder_started = 0;
ga_error("video encoder: create thread failed.\n");
return -1;
}
}
ga_error("video encdoer: all started (%d)\n", iid);
return 0;
}
static int
vencoder_stop(void *arg) {
int iid;
void *ignored;
if(vencoder_started == 0)
return 0;
vencoder_started = 0;
for(iid = 0; iid < video_source_channels(); iid++) {
pthread_join(vencoder_tid[iid], &ignored);
}
ga_error("video encdoer: all stopped (%d)\n", iid);
return 0;
}
static void *
vencoder_raw(void *arg, int *size) {
#if defined __APPLE__
int64_t in = (int64_t) arg;
int iid = (int) (in & 0xffffffffLL);
#else
int iid = (int) arg;
#endif
if(vencoder_initialized == 0)
return NULL;
if(size)
*size = sizeof(vencoder[iid]);
return vencoder[iid];
}
static int
x264_reconfigure(ga_ioctl_reconfigure_t *reconf) {
if(vencoder_started == 0 || encoder_running() == 0) {
ga_error("video encoder: reconfigure - not running.\n");
return 0;
}
pthread_mutex_lock(&vencoder_reconf_mutex[reconf->id]);
bcopy(reconf, &vencoder_reconf[reconf->id], sizeof(ga_ioctl_reconfigure_t));
pthread_mutex_unlock(&vencoder_reconf_mutex[reconf->id]);
return 0;
}
static int
x264_get_sps_pps(int iid) {
x264_nal_t *p_nal;
int ret = 0;
int i, i_nal;
// alread obtained?
if(_sps[iid] != NULL)
return 0;
//
if(vencoder_initialized == 0)
return GA_IOCTL_ERR_NOTINITIALIZED;
if(x264_encoder_headers(vencoder[iid], &p_nal, &i_nal) < 0)
return GA_IOCTL_ERR_NOTFOUND;
for(i = 0; i < i_nal; i++) {
if(p_nal[i].i_type == NAL_SPS) {
if((_sps[iid] = (char*) malloc(p_nal[i].i_payload)) == NULL) {
ret = GA_IOCTL_ERR_NOMEM;
break;
}
bcopy(p_nal[i].p_payload, _sps[iid], p_nal[i].i_payload);
_spslen[iid] = p_nal[i].i_payload;
} else if(p_nal[i].i_type == NAL_PPS) {
if((_pps[iid] = (char*) malloc(p_nal[i].i_payload)) == NULL) {
ret = GA_IOCTL_ERR_NOMEM;
break;
}
bcopy(p_nal[i].p_payload, _pps[iid], p_nal[i].i_payload);
_ppslen[iid] = p_nal[i].i_payload;
}
}
//
if(_sps[iid] == NULL || _pps[iid] == NULL) {
if(_sps[iid]) free(_sps[iid]);
if(_pps[iid]) free(_pps[iid]);
_sps[iid] = _pps[iid] = NULL;
_spslen[iid] = _ppslen[iid] = 0;
} else {
ga_error("video encoder: found sps (%d bytes); pps (%d bytes)\n",
_spslen[iid], _ppslen[iid]);
}
return ret;
}
static int
vencoder_ioctl(int command, int argsize, void *arg) {
int ret = 0;
ga_ioctl_buffer_t *buf = (ga_ioctl_buffer_t*) arg;
//
if(vencoder_initialized == 0)
return GA_IOCTL_ERR_NOTINITIALIZED;
//
switch(command) {
case GA_IOCTL_RECONFIGURE:
if(argsize != sizeof(ga_ioctl_reconfigure_t))
return GA_IOCTL_ERR_INVALID_ARGUMENT;
x264_reconfigure((ga_ioctl_reconfigure_t*) arg);
break;
case GA_IOCTL_GETSPS:
if(argsize != sizeof(ga_ioctl_buffer_t))
return GA_IOCTL_ERR_INVALID_ARGUMENT;
if(x264_get_sps_pps(buf->id) < 0)
return GA_IOCTL_ERR_NOTFOUND;
if(buf->size < _spslen[buf->id])
return GA_IOCTL_ERR_BUFFERSIZE;
buf->size = _spslen[buf->id];
bcopy(_sps[buf->id], buf->ptr, buf->size);
break;
case GA_IOCTL_GETPPS:
if(argsize != sizeof(ga_ioctl_buffer_t))
return GA_IOCTL_ERR_INVALID_ARGUMENT;
if(x264_get_sps_pps(buf->id) < 0)
return GA_IOCTL_ERR_NOTFOUND;
if(buf->size < _ppslen[buf->id])
return GA_IOCTL_ERR_BUFFERSIZE;
buf->size = _ppslen[buf->id];
bcopy(_pps[buf->id], buf->ptr, buf->size);
break;
default:
ret = GA_IOCTL_ERR_NOTSUPPORTED;
break;
}
return ret;
}
ga_module_t *
module_load() {
static ga_module_t m;
//
bzero(&m, sizeof(m));
m.type = GA_MODULE_TYPE_VENCODER;
m.name = strdup("x264-video-encoder");
m.mimetype = strdup("video/H264");
m.init = vencoder_init;
m.start = vencoder_start;
//m.threadproc = vencoder_threadproc;
m.stop = vencoder_stop;
m.deinit = vencoder_deinit;
//
m.raw = vencoder_raw;
m.ioctl = vencoder_ioctl;
return &m;
}
| [
"chuang@ntou.edu.tw"
] | chuang@ntou.edu.tw |
7d9d476fdf176e2af057a4bd9368e9bb1e46ed08 | 50a56ae2412be295b074dfea324c9dc5fba6de30 | /hdu/5835.cpp | 0bc98332e9fb3267fed14a356309b4b74b6c6982 | [] | no_license | xbhoneybee/ACM_ICPC | f92f8cace72935de285d84a4bfb42cc402bdcc5e | 1bb892e5a4cf0cc1e9f9511e768b99fba7a639eb | refs/heads/master | 2020-12-04T02:30:35.005974 | 2018-05-03T12:00:09 | 2018-05-03T12:00:09 | 66,524,703 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,297 | cpp | #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <cmath>
#include <string.h>
#include <set>
#include <queue>
#include <cctype>
#include <map>
#include <stack>
#define inf 1000000000000000000
#define ll long long
#define LL long long
#define iosfalse ios::sync_with_stdio(false);
using namespace std;
//题目数据有bug 可以用sum/2 水过,所以我这题不确定一定正确
int main()
{
int t;
int a[15]={0};
scanf("%d",&t);
for(int it=1;it<=t;it++)
{
printf("Case #%d: ",it);
int n;
int sum=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
if(n==1) {
if(a[0]>=2) printf("1\n");
else printf("0\n");
continue;
}
sort(a,a+n);
int cost=0;
int i=0,j=n-1;
for(;i<j;)
{
if(cost+a[i]*2<=sum/2)
{
cost+=a[i]*2;
if(a[j]>=a[i])
a[j]-=a[i];
else{
a[j-1]-=(a[i]-a[j]);
a[j]=0;j--;
}
i++;
}else
{
cost=sum/2;
break;
}
}
if(cost<sum/2) cost++;
printf("%d\n",cost);
}
return 0;
}
| [
"qq383441907@outlook.com"
] | qq383441907@outlook.com |
e3ed2b1336cdd73143b79663b645d4ce8fd371ea | 35c68dcf18d134ce7d87b716a9183d48f39f0861 | /src/core/os/lnx/wayland/waylandWindowSystemWsa.h | 819b3f4b54fe04ef46d9e2f22806490f3edd423e | [
"MIT"
] | permissive | hustwarhd/pal | 858367d8c6c7ef602c3b4d93ceaea445690a3854 | b88de6c975d81881686d709803f130b264c8d58c | refs/heads/master | 2020-04-02T09:29:14.919314 | 2018-10-17T02:29:02 | 2018-10-17T02:31:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,007 | h | /*
***********************************************************************************************************************
*
* Copyright (c) 2018 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
**********************************************************************************************************************/
#pragma once
#include "pal.h"
#include "palFile.h"
#include "core/os/lnx/lnxWindowSystem.h"
#include "wsa.h"
#if PAL_CLIENT_INTERFACE_MAJOR_VERSION >= 392
namespace Pal
{
namespace Linux
{
class Device;
class WaylandWindowSystem;
// =====================================================================================================================
// The definition of Present fence for wayland platform.
class WaylandPresentFence : public PresentFence
{
public:
static size_t GetSize() { return sizeof(WaylandPresentFence); }
static Result Create(
const WaylandWindowSystem& windowSystem,
bool initiallySignaled,
void* pPlacementAddr,
PresentFence** ppPresentFence);
virtual void Reset() override;
virtual Result Trigger() override;
virtual Result WaitForCompletion(bool doWait) override;
void SetImage(int32 hImage) { m_hImage = hImage; }
private:
explicit WaylandPresentFence(const WaylandWindowSystem& windowSystem);
virtual ~WaylandPresentFence();
Result Init(bool initiallySignaled);
const WaylandWindowSystem& m_windowSystem;
int32 m_hImage;
PAL_DISALLOW_DEFAULT_CTOR(WaylandPresentFence);
PAL_DISALLOW_COPY_AND_ASSIGN(WaylandPresentFence);
};
// =====================================================================================================================
// Represent a window system with wayland extension.
class WaylandWindowSystem : public WindowSystem
{
public:
// The WindowSystem class is designed to be placed into other PAL objects which requires the Create/Destroy pattern.
static size_t GetSize() { return sizeof(WaylandWindowSystem); }
static Result Create(
const Device& device,
const WindowSystemCreateInfo& createInfo,
void* pPlacementAddr,
WindowSystem** ppWindowSystem);
// Helper functions to describe the properties of a window system we will create in the future.
static Result GetWindowGeometry(
Device* pDevice,
OsDisplayHandle hDisplay,
OsWindowHandle hWindow,
Extent2d* pExtents);
static Result DeterminePresentationSupported(
Device* pDevice,
OsDisplayHandle hDisplay,
int64 visualId);
static Result LoadWaylandWsa();
virtual Result CreatePresentableImage(
Image* pImage,
int32 sharedBufferFd) override;
virtual void DestroyPresentableImage(
WindowSystemImageHandle hImage) override;
virtual Result Present(
const PresentSwapChainInfo& presentInfo,
PresentFence* pRenderFence,
PresentFence* pIdleFence) override;
virtual Result WaitForLastImagePresented() override;
private:
WaylandWindowSystem(const Device& device, const WindowSystemCreateInfo& createInfo);
virtual ~WaylandWindowSystem();
Result Init();
const Device& m_device;
void* m_pDisplay; // wayland display created by App
void* m_pSurface; // wayland surface created by App
int32 m_hWsa;
static WsaInterface* s_pWsaInterface;
friend WaylandPresentFence;
PAL_DISALLOW_DEFAULT_CTOR(WaylandWindowSystem);
PAL_DISALLOW_COPY_AND_ASSIGN(WaylandWindowSystem);
static constexpr int32 DefaultImageHandle = -1;
};
} // Linux
} // Pal
#endif
| [
"jacob.he@amd.com"
] | jacob.he@amd.com |
e6e840e87aa6808f82f07ccdd21ec3fc20a2d8d1 | 0bd63ea82005e5e1d4b1e015b164e6bfdc410a9d | /CDrawTool.h | 268ea76a0095f39249e9add81aac9958f88ad010 | [] | no_license | tonymin/DrawTool | 442ef62d74b43d8032a0911001ae27e5464fe44d | 9c22caede19c22a519336e11eda36e9ad68bf03b | refs/heads/master | 2022-11-08T23:27:30.854092 | 2020-05-22T21:58:04 | 2020-05-22T21:58:04 | 266,177,019 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 491 | h | #pragma once
#include <QtWidgets/QMainWindow>
#include "ui_DrawTool.h"
#include <QPointer>
namespace Core {
namespace Graphics {
class CGraphicsView;
}
}
namespace Core {
class CDrawTool : public QMainWindow
{
Q_OBJECT
public:
CDrawTool(QWidget *parent = Q_NULLPTR);
private:
void createToolBar();
private slots:
void onDebug();
void onGenerate();
void onRun();
private:
Ui::DrawToolClass ui;
QPointer<Graphics::CGraphicsView> m_view;
QAction* m_debugAct = nullptr;
};
} | [
"22283515+tonymin@user.noreply.github.com"
] | 22283515+tonymin@user.noreply.github.com |
ecf27fd1be367f34f43d485926785ba692e5db7e | cf9b89b4b70f43f46eb7f1aa1198f76e42dc5e39 | /ShrinkPlanet/Sphere.cpp | dbe87f0cec2cab1537c59b8154dedfa4457259f9 | [] | no_license | J-Kyu/ComputerGraphicsTermProject | 1ce39eda2b59366e8370ad2db5208cd938c991ca | 5ff90c48ab38b68dd55a4c32e2a36f1d64ac328e | refs/heads/master | 2022-11-10T03:26:57.769330 | 2020-06-20T08:03:58 | 2020-06-20T08:03:58 | 267,842,888 | 0 | 1 | null | 2020-06-20T08:03:59 | 2020-05-29T11:38:46 | C | UTF-8 | C++ | false | false | 2,355 | cpp | #include "Sphere.h"
void Sphere::CalVertices() {
get_sphere_3d(vertices);
}
void Sphere::get_sphere_3d(vector<GLfloat>& p) {
double theta0;
double theta1;
double y0;
double rst0;
double y1;
double rst1;
double phi0;
double phi1;
double cp0;
double sp0;
double cp1;
double sp1;
float vx0, vy0, vz0, vx1, vy1, vz1;
float vx2, vy2, vz2, vx3, vy3, vz3;
for (int i = 1; i <= subh; i++) {
if (i == 1) {
//init angles
theta0 = M_PI * (i - 1) / subh;
y0 = r * cos(theta0);
rst0 = r * sin(theta0);
}
else {
//old angles
theta0 = theta1;
y0 = y1;
rst0 = rst1;
}
//new angles
theta1 = M_PI * i / subh;
y1 = r * cos(theta1);
rst1 = r * sin(theta1);
for (int j = 1; j <= suba; j++) {
if (j == 1 || j == suba) {
//init angles & final angle
phi0 = 2 * (M_PI) * (j - 1) / suba;
phi1 = 2 * M_PI * j / suba;
cp0 = cos(phi0);
sp0 = sin(phi0);
cp1 = cos(phi1);
sp1 = sin(phi1);
FSET_VTX3(vx0, vy0, vz0, sp0 * rst0, y0, cp0 * rst0);
FSET_VTX3(vx1, vy1, vz1, sp0 * rst1, y1, cp0 * rst1);
FSET_VTX3(vx2, vy2, vz2, sp1 * rst0, y0, cp1 * rst0);
FSET_VTX3(vx3, vy3, vz3, sp1 * rst1, y1, cp1 * rst1);
}
else {
//new angles
phi1 = 2 * M_PI * j / suba;
cp1 = cos(phi1);
sp1 = sin(phi1);
//resuse old points
FSET_VTX3(vx0, vy0, vz0, vx2, vy2, vz2);
FSET_VTX3(vx1, vy1, vz1, vx3, vy3, vz3);
FSET_VTX3(vx2, vy2, vz2, sp1 * rst0, y0, cp1 * rst0);
FSET_VTX3(vx3, vy3, vz3, sp1 * rst1, y1, cp1 * rst1);
}
if (i < subh) {
FPUSH_VTX3(p, vx0, vy0, vz0);
FPUSH_VTX3(p, vx1, vy1, vz1);
FPUSH_VTX3(p, vx3, vy3, vz3);
FPUSH_VTX3(normals, vx0 / r, vy0 / r, vz0 / r);
FPUSH_VTX3(normals, vx1 / r, vy1 / r, vz1 / r);
FPUSH_VTX3(normals, vx3 / r, vy3 / r, vz3 / r);
}
if (1 < i) {
FPUSH_VTX3(p, vx3, vy3, vz3);
FPUSH_VTX3(p, vx2, vy2, vz2);
FPUSH_VTX3(p, vx0, vy0, vz0);
FPUSH_VTX3(normals, vx3 / r, vy3 / r, vz3 / r);
FPUSH_VTX3(normals, vx2 / r, vy2 / r, vz2 / r);
FPUSH_VTX3(normals, vx0 / r, vy0 / r, vz0 / r);
}
}
}
}
void Sphere::BindElements() {
/*
Elements is not necessary for this object
*/
}
void Sphere::RenderGraphic() {
//cout << "Draw: "<< vertices.size() <<"\t"<< colors.size() << endl;
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
} | [
"wjstkdrb91@naver.com"
] | wjstkdrb91@naver.com |
3d97186935a76f27b125d0ee9985169fa28cfafd | 4258a21020932d0849a95c182aa8086a0467e641 | /sdk/verify/live555/sample/mixer/inc/dla/I6E/mid_ipu_detect.h | ed441cef2e2aabff73e2f2179d1bf7a09b805def | [] | no_license | sengeiou/Democode-TAKOYAKI-BETA001-0312 | a04647412764b57532a1b8ca02a1b4966a5a5395 | 0c3261e5c067314d2ac4f858399fff8cc2793f01 | refs/heads/master | 2022-05-24T09:48:13.816615 | 2020-04-13T10:47:24 | 2020-04-13T10:47:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,786 | h | #ifndef _MID_IPU_DETECT_H_
#define _MID_IPU_DETECT_H_
#include "mid_ipu_interface.h"
#include "mid_dla.h"
#include <string.h>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <vector>
#define LABEL_CLASS_COUNT (1200)
#define LABEL_NAME_MAX_SIZE (60)
using namespace std;
struct DetectionBBoxInfo
{
float xmin;
float ymin;
float xmax;
float ymax;
float score;
int classID;
};
class CMidIPUDetect : public CMidIPUInterface
{
public:
CMidIPUDetect(IPU_InitInfo_S &stInitInfo);
virtual ~CMidIPUDetect();
int InitResource();
int ReleaseResource();
void DealDataProcess();
private:
int InitStreamSource();
int ReleaseStreamSource();
int DoDetect(MI_SYS_BufInfo_t* pstBufInfo);
MI_S32 SetIeParam(IeParamInfo tmp,MI_U8 scop);
int ScaleToModelSize(MI_SYS_BufInfo_t* pstBufInfo, MI_IPU_TensorVector_t* pstInputTensorVector);
std::vector<DetectionBBoxInfo > GetDetections(float *pfBBox, float *pfClass, float *pfScore, float *pfDetect);
void PrintResult(MI_IPU_TensorVector_t* pstOutputTensorVector);
private:
MI_VPE_CHANNEL m_vpeChn;
MI_VPE_PORT m_vpePort;
MI_DIVP_CHN m_divpChn;
MI_IPU_CHN m_ipuChn;
MI_U32 m_u32InBufDepth;
MI_U32 m_u32OutBufDepth;
MI_U32 m_u32Width;
MI_U32 m_u32Height;
MI_S32 m_s32Fd;
MI_IPU_SubNet_InputOutputDesc_t m_stNPUDesc;
char m_szLabelName[LABEL_CLASS_COUNT][LABEL_NAME_MAX_SIZE];
MI_S32 m_s32LabelCount;
std::vector<Track> m_DetectTrackBBoxs;
IOUTracker m_DetectBBoxTracker;
};
#endif // _MID_IPU_DETECT_H_
| [
"zhaozhenhong5@aliyun.com"
] | zhaozhenhong5@aliyun.com |
b371dc3c81729a777df9c074e173eeb24e00c621 | 6fc4f7c1f9ab41026449e9b331621095923b2c8e | /tracing.h | ccbbe1ea0d3de1e91b7d7bd2fae1e9d53efe19dc | [
"BSD-3-Clause"
] | permissive | lettuRL/libcacc | 3f0d93d6358de7f7f9970e473aa56d956f600737 | b9fdcd39bd13ec7ad1a29802d884b68c1ea6b3d7 | refs/heads/master | 2023-06-11T11:38:27.832174 | 2018-12-17T21:25:54 | 2018-12-17T21:25:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,617 | h | /*
* Copyright (C) 2015-2018, Nils Moehrle
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
*/
#ifndef CACC_TRACING_HEADER
#define CACC_TRACING_HEADER
#include "bvh_tree.h"
#include "primitives.h"
CACC_NAMESPACE_BEGIN
#define TRACING_NAMESPACE_BEGIN namespace tracing {
#define TRACING_NAMESPACE_END }
TRACING_NAMESPACE_BEGIN
//WARNING works only with 1D/2D blocks
//TRACING_SSTACK_SIZE * TRACING_BLOCK_SIZE * sizeof(uint) <! block smem limit
#ifndef TRACING_BLOCK_SIZE
#define TRACING_BLOCK_SIZE 128
#endif
#ifndef TRACING_SSTACK_SIZE
#define TRACING_SSTACK_SIZE 12
#endif
#ifndef TRACING_GSTACK_SIZE
#define TRACING_GSTACK_SIZE 64
#endif
constexpr uint NAI = (uint) -1;
__device__
bool trace(cacc::BVHTree<cacc::DEVICE>::Accessor const & bvh_tree,
cacc::Ray const & ray, uint * hit_face_id_ptr = nullptr)
{
#if TRACING_SSTACK_SIZE
const int tx = threadIdx.x;
const int ty = threadIdx.y;
const int id = ty * blockDim.x + tx;
uint __shared__ sstack[TRACING_SSTACK_SIZE * TRACING_BLOCK_SIZE];
#endif
float t = inf;
uint hit_face_id = NAI;
uint gstack[TRACING_GSTACK_SIZE];
uint node_idx = 0;
int stack_idx = -1;
while (true) {
BVHTree<DEVICE>::Node node;
node = bvh_tree.load_node(node_idx);
if (node.left != NAI && node.right != NAI) {
float tmin_left, tmin_right;
AABB aabb_left = bvh_tree.load_aabb(node.left);
bool left = intersect(ray, aabb_left, &tmin_left);
AABB aabb_right = bvh_tree.load_aabb(node.right);
bool right = intersect(ray, aabb_right, &tmin_right);
if (left && right) {
uint other;
if (tmin_left < tmin_right) {
other = node.right;
node_idx = node.left;
} else {
other = node.left;
node_idx = node.right;
}
#if TRACING_SSTACK_SIZE
if (++stack_idx < TRACING_SSTACK_SIZE)
sstack[TRACING_BLOCK_SIZE * stack_idx + id] = other;
else gstack[stack_idx - TRACING_SSTACK_SIZE] = other;
#else
gstack[++stack_idx] = other;
#endif
} else {
if (right) node_idx = node.right;
if (left) node_idx = node.left;
}
if (!left && !right) {
if (stack_idx < 0) break;
#if TRACING_SSTACK_SIZE
if (stack_idx < TRACING_SSTACK_SIZE)
node_idx = sstack[TRACING_BLOCK_SIZE * stack_idx-- + id];
else node_idx = gstack[stack_idx-- - TRACING_SSTACK_SIZE];
#else
node_idx = gstack[stack_idx--];
#endif
}
} else {
for (uint i = node.first; i < node.last; ++i) {
Tri tri = bvh_tree.load_tri(i);
if (intersect(ray, tri, &t)) {
hit_face_id = bvh_tree.indices_ptr[i];
}
}
if (stack_idx < 0) break;
#if TRACING_SSTACK_SIZE
if (stack_idx < TRACING_SSTACK_SIZE)
node_idx = sstack[TRACING_BLOCK_SIZE * stack_idx-- + id];
else node_idx = gstack[stack_idx-- - TRACING_SSTACK_SIZE];
#else
node_idx = gstack[stack_idx--];
#endif
}
}
if (hit_face_id_ptr != nullptr) *hit_face_id_ptr = hit_face_id;
return hit_face_id != NAI;
}
TRACING_NAMESPACE_END
CACC_NAMESPACE_END
#endif /* CACC_TRACING_HEADER */
| [
"nils@kuenstle-moehrle.de"
] | nils@kuenstle-moehrle.de |
1962027a4e7a5fc86873acd8ec20f197a2620083 | 1f63dde39fcc5f8be29f2acb947c41f1b6f1683e | /Boss2D/addon/webrtc-jumpingyang001_for_boss/logging/rtc_event_log/rtc_event_log2rtp_dump.cc | 47f0f5944073c19ebe41c26eef4bd161bb1bf447 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-google-patent-license-webm",
"LicenseRef-scancode-google-patent-license-webrtc",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | koobonil/Boss2D | 09ca948823e0df5a5a53b64a10033c4f3665483a | e5eb355b57228a701495f2660f137bd05628c202 | refs/heads/master | 2022-10-20T09:02:51.341143 | 2019-07-18T02:13:44 | 2019-07-18T02:13:44 | 105,999,368 | 7 | 2 | MIT | 2022-10-04T23:31:12 | 2017-10-06T11:57:07 | C++ | UTF-8 | C++ | false | false | 7,850 | cc | /*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <string.h>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include BOSS_WEBRTC_U_logging__rtc_event_log__rtc_event_log_h //original-code:"logging/rtc_event_log/rtc_event_log.h"
#include BOSS_WEBRTC_U_logging__rtc_event_log__rtc_event_log_parser_new_h //original-code:"logging/rtc_event_log/rtc_event_log_parser_new.h"
#include BOSS_WEBRTC_U_modules__rtp_rtcp__source__byte_io_h //original-code:"modules/rtp_rtcp/source/byte_io.h"
#include BOSS_WEBRTC_U_modules__rtp_rtcp__source__rtp_utility_h //original-code:"modules/rtp_rtcp/source/rtp_utility.h"
#include BOSS_WEBRTC_U_rtc_base__checks_h //original-code:"rtc_base/checks.h"
#include BOSS_WEBRTC_U_rtc_base__flags_h //original-code:"rtc_base/flags.h"
#include "test/rtp_file_writer.h"
namespace {
using MediaType = webrtc::ParsedRtcEventLogNew::MediaType;
DEFINE_bool(
audio,
true,
"Use --noaudio to exclude audio packets from the converted RTPdump file.");
DEFINE_bool(
video,
true,
"Use --novideo to exclude video packets from the converted RTPdump file.");
DEFINE_bool(
data,
true,
"Use --nodata to exclude data packets from the converted RTPdump file.");
DEFINE_bool(
rtp,
true,
"Use --nortp to exclude RTP packets from the converted RTPdump file.");
DEFINE_bool(
rtcp,
true,
"Use --nortcp to exclude RTCP packets from the converted RTPdump file.");
DEFINE_string(ssrc,
"",
"Store only packets with this SSRC (decimal or hex, the latter "
"starting with 0x).");
DEFINE_bool(help, false, "Prints this message.");
// Parses the input string for a valid SSRC. If a valid SSRC is found, it is
// written to the output variable |ssrc|, and true is returned. Otherwise,
// false is returned.
// The empty string must be validated as true, because it is the default value
// of the command-line flag. In this case, no value is written to the output
// variable.
bool ParseSsrc(std::string str, uint32_t* ssrc) {
// If the input string starts with 0x or 0X it indicates a hexadecimal number.
auto read_mode = std::dec;
if (str.size() > 2 &&
(str.substr(0, 2) == "0x" || str.substr(0, 2) == "0X")) {
read_mode = std::hex;
str = str.substr(2);
}
std::stringstream ss(str);
ss >> read_mode >> *ssrc;
return str.empty() || (!ss.fail() && ss.eof());
}
} // namespace
// This utility will convert a stored event log to the rtpdump format.
int main(int argc, char* argv[]) {
std::string program_name = argv[0];
std::string usage =
"Tool for converting an RtcEventLog file to an RTP dump file.\n"
"Run " +
program_name +
" --help for usage.\n"
"Example usage:\n" +
program_name + " input.rel output.rtp\n";
if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) || FLAG_help ||
argc != 3) {
std::cout << usage;
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
return 0;
}
return 1;
}
std::string input_file = argv[1];
std::string output_file = argv[2];
uint32_t ssrc_filter = 0;
if (strlen(FLAG_ssrc) > 0)
RTC_CHECK(ParseSsrc(FLAG_ssrc, &ssrc_filter))
<< "Flag verification has failed.";
webrtc::ParsedRtcEventLogNew parsed_stream;
if (!parsed_stream.ParseFile(input_file)) {
std::cerr << "Error while parsing input file: " << input_file << std::endl;
return -1;
}
std::unique_ptr<webrtc::test::RtpFileWriter> rtp_writer(
webrtc::test::RtpFileWriter::Create(
webrtc::test::RtpFileWriter::FileFormat::kRtpDump, output_file));
if (!rtp_writer.get()) {
std::cerr << "Error while opening output file: " << output_file
<< std::endl;
return -1;
}
std::cout << "Found " << parsed_stream.GetNumberOfEvents()
<< " events in the input file." << std::endl;
int rtp_counter = 0, rtcp_counter = 0;
bool header_only = false;
for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) {
// The parsed_stream will assert if the protobuf event is missing
// some required fields and we attempt to access them. We could consider
// a softer failure option, but it does not seem useful to generate
// RTP dumps based on broken event logs.
if (FLAG_rtp && parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLogNew::EventType::RTP_EVENT) {
webrtc::test::RtpPacket packet;
webrtc::PacketDirection direction;
parsed_stream.GetRtpHeader(i, &direction, packet.data, &packet.length,
&packet.original_length, nullptr);
if (packet.original_length > packet.length)
header_only = true;
packet.time_ms = parsed_stream.GetTimestamp(i) / 1000;
webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet.data,
packet.length);
// TODO(terelius): Maybe add a flag to dump outgoing traffic instead?
if (direction == webrtc::kOutgoingPacket)
continue;
webrtc::RTPHeader parsed_header;
rtp_parser.Parse(&parsed_header);
MediaType media_type =
parsed_stream.GetMediaType(parsed_header.ssrc, direction);
if (!FLAG_audio && media_type == MediaType::AUDIO)
continue;
if (!FLAG_video && media_type == MediaType::VIDEO)
continue;
if (!FLAG_data && media_type == MediaType::DATA)
continue;
if (strlen(FLAG_ssrc) > 0) {
const uint32_t packet_ssrc =
webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 8));
if (packet_ssrc != ssrc_filter)
continue;
}
rtp_writer->WritePacket(&packet);
rtp_counter++;
}
if (FLAG_rtcp && parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLogNew::EventType::RTCP_EVENT) {
webrtc::test::RtpPacket packet;
webrtc::PacketDirection direction;
parsed_stream.GetRtcpPacket(i, &direction, packet.data, &packet.length);
// For RTCP packets the original_length should be set to 0 in the
// RTPdump format.
packet.original_length = 0;
packet.time_ms = parsed_stream.GetTimestamp(i) / 1000;
// TODO(terelius): Maybe add a flag to dump outgoing traffic instead?
if (direction == webrtc::kOutgoingPacket)
continue;
// Note that |packet_ssrc| is the sender SSRC. An RTCP message may contain
// report blocks for many streams, thus several SSRCs and they doen't
// necessarily have to be of the same media type.
const uint32_t packet_ssrc = webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 4));
MediaType media_type = parsed_stream.GetMediaType(packet_ssrc, direction);
if (!FLAG_audio && media_type == MediaType::AUDIO)
continue;
if (!FLAG_video && media_type == MediaType::VIDEO)
continue;
if (!FLAG_data && media_type == MediaType::DATA)
continue;
if (strlen(FLAG_ssrc) > 0) {
if (packet_ssrc != ssrc_filter)
continue;
}
rtp_writer->WritePacket(&packet);
rtcp_counter++;
}
}
std::cout << "Wrote " << rtp_counter << (header_only ? " header-only" : "")
<< " RTP packets and " << rtcp_counter << " RTCP packets to the "
<< "output file." << std::endl;
return 0;
}
| [
"slacealic@nate.com"
] | slacealic@nate.com |
ec8853d821d5d935d87437eb244356189b44f325 | 30beea17e89863591576f1dd3dee4372e9c5945f | /Breakout/src/BallObject.cpp | 2c1a2230256bf6ff789ced67ee61d0e570969d7e | [] | no_license | MagnoVJ/Breakout | 30dcdeabad12c09426e60a85eaa76d76b15fdbbe | 62787c2de726898e8fed0edda743eed33d233fac | refs/heads/master | 2021-01-13T09:22:17.270642 | 2016-11-16T06:13:08 | 2016-11-16T06:13:08 | 69,750,532 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,525 | cpp | #include "BallObject.h"
BallObject::BallObject() : GameObject(), radius(12.5f), stuck(true), sticky(GL_FALSE), passThrough(GL_FALSE) { }
BallObject::BallObject(glm::vec2 pos, GLfloat radius, glm::vec2 velocity, Texture2D sprite)
: GameObject(pos, glm::vec2(radius * 2, radius * 2), sprite, glm::vec3(1.0f), velocity), radius(radius), stuck(true), sticky(GL_FALSE), passThrough(GL_FALSE) { }
glm::vec2 BallObject::move(GLfloat dt, GLuint windowWidth, GLuint windowHeight){
//If not stuck to player board
if(!stuck){
position += velocity * dt;
//Check if outside window bounds; if so, reverse velocity and restore at correct position
if(position.x <= 0.0f){
velocity.x = -velocity.x;
position.x = 0.0f;
}
else if(position.x + size.x >= windowWidth){
velocity.x = -velocity.x;
position.x = windowWidth - size.x;
}
if(position.y <= 0.0f){
velocity.y = -velocity.y;
position.y = 0.0f;
}
//Bola continua "bouoncing" ao alcancar o fundo da tela (para ser comentado depois)
/*else if(position.y + size.y >= windowHeight){
velocity.y = -velocity.y;
position.y = windowHeight - size.y;
}*/
}
return position;
}
// Resets the ball to initial Stuck Position (if ball is outside window bounds)
void BallObject::reset(glm::vec2 position, glm::vec2 velocity){
this->position = position;
this->velocity.x = (rand()%2==0?1:-1)*velocity.x; //Faz a bola iniciar para esquerda ou para direita
this->velocity.y = velocity.y;
stuck = true;
sticky = false;
passThrough = false;
} | [
"magnovj@gmail.com"
] | magnovj@gmail.com |
553d35c3cba08bca6764166a520a022f92ad3901 | 275ec6905a664e6d50f6f7593d62066740b241a0 | /stl/foreach2.cpp | 09ff93190529bf8a8103eccdec29413c916a757c | [] | no_license | huangjiahua/cppLearningFiles | 0f135624d5d7d2256e8fd55146a408170737b603 | 7000ac6111b33c880a66c2c3cc2e4f41390aff9e | refs/heads/master | 2021-09-10T15:11:48.991007 | 2018-03-28T08:57:41 | 2018-03-28T08:57:41 | 122,352,150 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 355 | cpp | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
class PrintInt {
public:
void operator() (int elem) const {
cout << elem << ' ';
}
};
int main()
{
vector<int> coll;
for (int i = 1; i <= 9; ++i)
coll.push_back(i);
for_each(coll.cbegin(), coll.cend(), PrintInt());
cout << endl;
}
| [
"hjh4477@outlook.com"
] | hjh4477@outlook.com |
35af57b89ac9ddba627e6482f91c9cb54995e609 | dac70221ae783796868881a66c1b9dc5572ae6ae | /Source of PBO/adx_pack/vehicles/dc3/CfgPatches.hpp | 2581910b5579c6855b49cc88e3a6675be17f56b5 | [
"Unlicense"
] | permissive | ADXTeam/DayZADX | 787ed2e71249c7fef2d7996ecf3ff59affc48b99 | 97924bc18ed374df854f2aa5eee0ae960bb47811 | refs/heads/master | 2020-04-06T06:43:27.579217 | 2013-11-08T15:20:20 | 2013-11-08T15:20:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 139 | hpp | class CfgPatches {
class ori_dc3 {
units[] = {"dc3"};
weapons[] = {};
requiredVersion = 1.0;
requiredAddons[] = {"CAAir"};
};
};
| [
"keveltv@gmail.com"
] | keveltv@gmail.com |
0806acfdee950d1760f59484822d6a6224dec60b | cc8f6dd6f67058d3389b90ca0c7ddfe7e8916289 | /Chapter9/MoneyFactory.h | f8325dbf01f8cd432f13c59bbc61a58976fa4618 | [] | no_license | zhb94430/TDD-Part1 | ef6f050e60a4a6cb050c1a258b139c7a3bc9e772 | ca009d3bfdce927018b12fc17adda36587a1e14b | refs/heads/main | 2023-06-03T22:38:56.717677 | 2021-06-18T20:22:19 | 2021-06-18T20:22:19 | 373,364,841 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 193 | h | #pragma once
#include "Money.h"
#include "Dollar.h"
#include "Franc.h"
class MoneyFactory
{
public:
MoneyFactory(){};
static Money* dollar(int amount);
static Money* franc(int amount);
}; | [
"zhan2385@umn.edu"
] | zhan2385@umn.edu |
d8fbec3ad4d399e0728c87f47cf16233cfd27c33 | d5b9801ebaa288fc05e3c1823dae8e0f7f276a84 | /src/libs/perfMeasurement/PMManager.cpp | dd3b2c56e8bfcb4fea135397ca6a0b8240c706b4 | [] | no_license | hkeeble/torcs-adaptive | 5b112f0c7b001301830780c5b9162339574b6404 | e125334a3547082781198ef49b7007d72d7daa26 | refs/heads/master | 2020-04-12T17:44:52.175581 | 2014-08-06T10:53:24 | 2014-08-06T10:53:24 | 13,444,893 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,742 | cpp | /*
File: PMManager.cpp
Author: Henri Keeble
Desc: Definitions for a performance measurement manager class.
*/
#include "perfMeasurement\PMManager.h"
#include "Util.h"
namespace perfMeasurement
{
PMManager* PMManager::instance = nullptr;
PMManager* PMManager::Get()
{
if (instance)
return instance;
else
{
instance = new PMManager();
return instance;
}
}
PMManager::~PMManager()
{
if (Evaluator)
delete Evaluator;
}
tCarElt* PMManager::GetCar()
{
return Evaluator->GetCar();
}
void PMManager::Update(tdble deltaTimeIncrement, tdble currentTime)
{
Evaluator->Update(deltaTimeIncrement, currentTime);
}
void PMManager::Clear()
{
Evaluator->ClearData();
}
tdble PMManager::GetSkillEstimate()
{
return Evaluator->GetCurrentEstimate();
}
tdble PMManager::GetAverageEstimate()
{
return Evaluator->GetAverageEstimate();
}
void PMManager::Init(PMEvaluator* evaluator)
{
Evaluator = evaluator;
}
void PMManager::OutputData(std::string filepath)
{
std::ofstream file;
file.open(filepath);
file << " ----- PERFORMANCE EVALUATION REPORT ----- " << "\n\n";
// Output driver name
file << "-- INFORMATION --\n";
file << "Driver: " << Evaluator->GetCar()->info.name << "\n";
file << "Car: " << Evaluator->GetCar()->info.carName << "\n";
file << "Average Skill Estimate: " << Evaluator->GetAverageEstimate() << "\n";
file << "Total number of Estimates: " << Evaluator->GetEstimates().size() << "\n\n";
// Output all estimates in sequential order
file << "-- RAW ESTIMATE DATA --\n";
const std::vector<tdble> estimates = Evaluator->GetEstimates();
for (auto &i : estimates)
file << i << "\n";
file.close();
Evaluator->RaceEnd();
}
} | [
"henrikeeble@btinternet.com"
] | henrikeeble@btinternet.com |
44f4fa72f3f3d7f2be534421c5e9d37fb8d0466c | 0f7a4119185aff6f48907e8a5b2666d91a47c56b | /sstd_utility/windows_boost/boost/archive/iterators/escape.hpp | 62f043d0c4f6c8ed62faffbf8ef42ab4d1e8d15c | [] | no_license | jixhua/QQmlQuickBook | 6636c77e9553a86f09cd59a2e89a83eaa9f153b6 | 782799ec3426291be0b0a2e37dc3e209006f0415 | refs/heads/master | 2021-09-28T13:02:48.880908 | 2018-11-17T10:43:47 | 2018-11-17T10:43:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,089 | hpp | #ifndef BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
#define BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// escape.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/assert.hpp>
#include <cstddef> // NULL
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/iterator_traits.hpp>
namespace boost {
namespace archive {
namespace iterators {
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// insert escapes into text
template<class Derived, class Base>
class escape :
public boost::iterator_adaptor<
Derived,
Base,
typename boost::iterator_value<Base>::type,
single_pass_traversal_tag,
typename boost::iterator_value<Base>::type
>
{
typedef typename boost::iterator_value<Base>::type base_value_type;
typedef typename boost::iterator_reference<Base>::type reference_type;
friend class boost::iterator_core_access;
typedef typename boost::iterator_adaptor<
Derived,
Base,
base_value_type,
single_pass_traversal_tag,
base_value_type
> super_t;
typedef escape<Derived, Base> this_t;
void dereference_impl() {
m_current_value = static_cast<Derived *>(this)->fill(m_bnext, m_bend);
m_full = true;
}
//Access the value referred to
reference_type dereference() const {
if(!m_full)
const_cast<this_t *>(this)->dereference_impl();
return m_current_value;
}
bool equal(const this_t & rhs) const {
if(m_full){
if(! rhs.m_full)
const_cast<this_t *>(& rhs)->dereference_impl();
}
else{
if(rhs.m_full)
const_cast<this_t *>(this)->dereference_impl();
}
if(m_bnext != rhs.m_bnext)
return false;
if(this->base_reference() != rhs.base_reference())
return false;
return true;
}
void increment(){
if(++m_bnext < m_bend){
m_current_value = *m_bnext;
return;
}
++(this->base_reference());
m_bnext = NULL;
m_bend = NULL;
m_full = false;
}
// buffer to handle pending characters
const base_value_type *m_bnext;
const base_value_type *m_bend;
bool m_full;
base_value_type m_current_value;
public:
escape(Base base) :
super_t(base),
m_bnext(NULL),
m_bend(NULL),
m_full(false),
m_current_value(0)
{
}
};
} // namespace iterators
} // namespace archive
} // namespace boost
#endif // BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
| [
"nanguazhude@vip.qq.com"
] | nanguazhude@vip.qq.com |
2653767e54adadfe1c74145031d2c7674cfce94c | d303b8a2f1009adb8b95bfe2ecd953204c846a74 | /forum3/forum3/Rational.cpp | 830a13163474050efdedbfd2080540c984c4a554 | [] | no_license | codeserfer/2-term | 20552cfb996ae246bbc3a84fca67b5e692cd3cee | 27330770ebe4724b49f58eda453af13305ffeb9a | refs/heads/master | 2021-01-10T20:07:19.995451 | 2014-02-04T21:52:27 | 2014-02-04T21:52:27 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,748 | cpp | #include "stdafx.h"
#include "Rational.h"
#include <iostream>
Rational::Rational(void) {
n=0;
m=0;
}
Rational::Rational (int m=0, int n=1) {
if (n==0) throw (0);
save (m, n);
}
int Rational::del (int a, int b) {
int min=0;
if (a<b) min=a;
else min=b;
for (int i=2; i<=min; i++) if (a%i==0 && b%i==0) return i;
return 0;
}
void Rational::save (int m, int n) {
bool minus=false; //минуса нет
minus=(m<0)!=(n<0);
m=abs(m);
n=abs(n);
while (del(m, n)) {
int c_del=del (m, n);
m/=c_del;
n/=c_del;
}
if (minus) this->m=-1*m; else this->m=m;
this->n=n;
}
Rational::~Rational(void) {
}
Rational Rational::mult (Rational a, Rational b) {
this->save (a.m*b.m, a.n*b.n);
return *this;
}
Rational Rational::mult (Rational a, int b) {
this->save (a.m*b, a.n);
return *this;
}
Rational Rational::divis (Rational a, Rational b) {
this->save (a.m*b.n, a.n*b.m);
return *this;
}
Rational Rational::sum (Rational a, Rational b) {
this->save (b.n*a.m+a.n*b.m, a.n*b.n);
return *this;
}
Rational Rational::sum (Rational a, int b) {
this->save (a.m+b+a.n, a.n);
return *this;
}
Rational Rational::diff (Rational a, Rational b) {
if (a.m==0 || b.m==0) { this->save (0, 1); return *this; }
this->save (b.n*a.m-a.n*b.m, a.n*b.n);
return *this;
}
void Rational::print1 () {
std::cout << m<<"/"<<n;
}
void Rational::print2 () {
std::cout << (double)m/n;
}
int Rational::z (Rational a) {
if (a.m>0) return 1;
if (a.m==0) return 0;
if (a.m<0) return -1;
}
int Rational::compare (Rational a, Rational b) {
Rational c (0, 1);
c=c.diff (a, b);
if (c.z(c)>0) return 1;
if (c.z(c)==0) return 0;
if (c.z(c)<0) return -1;
} | [
"admin@codeserfer.com"
] | admin@codeserfer.com |
8ef3b9b3ad9be04957dea04388ea2845c4c131fe | 5b41e312db8aeb5532ba59498c93e2ec1dccd4ff | /Tools/Simulator/Simulator/CSocketConnectionForm.cpp | 12c6f1399481c90f9e43fb8b2cd0144c815acf2b | [] | no_license | frankilfrancis/KPO_HMI_vs17 | 10d96c6cb4aebffb83254e6ca38fe6d1033eba79 | de49aa55eccd8a7abc165f6057088a28426a1ceb | refs/heads/master | 2020-04-15T16:40:14.366351 | 2019-11-14T15:33:25 | 2019-11-14T15:33:25 | 164,845,188 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 20,346 | cpp | #include "StdAfx.h"
#include "CSocketConnectionForm.h"
#include "CXmlInterConnInfoSave.h"
#include "CXmlInterConnInfoOpen.h"
#include "CLogWriterWrapper.h"
#include "CInterConfigWrapper.h"
#include "CAppSetting.h"
using namespace simulator;
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnLoad(System::Object ^ sender, System::EventArgs ^ e)
{
initInterfaceListe();
initCompConfiguration();
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnCheckedLocHost(System::Object ^ sender, System::EventArgs ^ e)
{
comBxIpAddr->Items->Clear();
if(chkBxLocHost->Checked)
{
String^ host=System::Net::Dns::GetHostName();
System::Net::IPHostEntry^ hostInfo=System::Net::Dns::GetHostByName(host);
int count=hostInfo->AddressList->Length;
for(int i=0;i<count;i++)
{
comBxIpAddr->Items->Add(hostInfo->AddressList[i]);
}
comBxIpAddr->SelectedIndex=0;
txtBxIpCount->Text = System::Convert::ToString(count);
labHost->Text = host;
}
else
{
comBxIpAddr->Text = "";
txtBxIpCount->Text = "";
labHost->Text = "";
}
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnListBoxInterEnter(System::Object ^ sender, System::EventArgs ^ e)
{
updateFromViewToConn();
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnListBoxSelIndexChanged(System::Object ^ sender, System::EventArgs ^ e)
{
updateFromConnToView();
/*button1->Enabled=true;
button2->Enabled=true;*/
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnClickButtConnection(System::Object ^ sender, System::EventArgs ^ e)
{
int index;
String^ mess=nullptr;
String^ hostName=nullptr;
String^ ipAddr=nullptr;
int port = 0;
int ret;
bool ip = false;
//Pruefen, ob die Interface Einstellung richtig sind
index = listBoxInter->SelectedIndex;
//Interface Name
String^ interName = InterConnectionListe->getInterfaceName(index+1);
//Interface Einstellungen
CInterConfigWrapper^ interWr = gcnew CInterConfigWrapper();
if (interWr->isIdElementDefined(interName))
{
try
{
if (index > -1)
{
button1->Enabled = false;
ipAddr = comBxIpAddr->Text;
//Ueberpruefen, ob String in einer IP Adresse konvertiert werden kann.
System::Net::IPAddress::Parse(ipAddr);
//System::Net::IPAddress::Any(ipAddr);
ip = true;
port = System::Convert::ToInt32(txtBxPort->Text);
hostName = labHost->Text;
InterConnectionListe->setHostInfo(index+1, hostName, ipAddr,port);
if(ConnectionFlag) // DirectionType::Send
{
//Wenn Sender
try
{
ret = InterConnectionListe->buildConnection(index+1);
}
catch (ObjectDisposedException^ e)
{
mess = e->Message;
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mess,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mess,CMessageForm::MessTyp::Error);
ret = -1;
}
catch (SocketException^ e)
{
mess = e->Message;
MessageForm->writeLine(mess + "\nError COde : " + e->ErrorCode,CMessageForm::MessTyp::Error);
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mess,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
InterConnectionListe->disConnect(index+1);
ret = -1;
}
catch(Exception^ e)
{
mess = e->Message;
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mess,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mess,CMessageForm::MessTyp::Error);
ret = -1;
}
if(ret == 0)
{
String^ conTyp=nullptr;
if(radioButtServer->Checked)
conTyp="Bind to: ";
else
conTyp="Connecting to: ";
mess = String::Concat(conTyp,"IP-Addres: ",
ipAddr," Port: ",System::Convert::ToString(port));
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Info,mess,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mess,CMessageForm::MessTyp::Info);
InterConnectionListe->getInterfaceAt(index+1)->waitingForConnection();
System::Threading::Thread::CurrentThread->Sleep(100);
button2->Enabled = true;
button1->Enabled = false;
updateFromConnToView();
}
else
{
String^ stat;
if (InterConnectionListe->getInterfaceAt(index+1))
stat = InterConnectionListe->getInterfaceAt(index+1)->getStatusMessage();
stat = String::Concat(" IP ");
mess = String::Concat(stat, ipAddr, " PORT: ", System::Convert::ToString(port));
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mess,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mess,CMessageForm::MessTyp::Error);
button2->Enabled = false;
button1->Enabled = true;
}
}
else
{
labStatusInfo->Text = "Ready for receiving";
}
//button2->Enabled = true;
}// if (index...
}
catch(System::ArgumentException^ e)
{
String^ mes;
mes = String::Concat("Input of port is notvalid number value.",e->Message);
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mes,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
System::Windows::Forms::MessageBox::Show(nullptr,mes,"Error");
}
catch(System::FormatException^ e)
{
String^ mes;
if (ip)
mes = String::Concat("Input of port has invalid format.",e->Message);
else
mes = String::Concat("",e->Message);
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mes,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
System::Windows::Forms::MessageBox::Show(nullptr,mes,"Error");
}
catch(System::OverflowException^ e)
{
String^ mes;
mes = String::Concat("Port-number is out of range.",e->Message);
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mes,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
System::Windows::Forms::MessageBox::Show(nullptr,mes,"Error");
}
catch(System::Exception^ e)
{
String^ mes;
mes = String::Concat("Some System::Exception during connection! ",e->Message);
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mes,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mes,CMessageForm::MessTyp::Error);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
}
/*catch(System::ArgumentNullException* e)
{
String^ mes;
mes = String::Concat("aaa",e->Message);
MessageForm->writeLine(mes,CMessageForm::MessTyp::Error);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
}*/
}
else
{
String^ mess = "Interface configuration is wrong (Id element not defined), configure first!";
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,mess,__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mess,CMessageForm::MessTyp::Error);
}
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnClickButtDisconnect(System::Object ^ sender, System::EventArgs ^ e)
{
String^ mess=nullptr;
String^ hostName;
String^ ipAddr;
int port;
int index = listBoxInter->SelectedIndex;
if (index > -1)
{
button2->Enabled = false;
InterConnectionListe->getHostInfo(index+1,hostName,ipAddr,&port);
mess= String::Concat("Closed Connection: ","IP - Address: ",ipAddr,"Port: ",System::Convert::ToString(port));
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Info,mess,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(mess,CMessageForm::MessTyp::Info);
try
{
InterConnectionListe->disConnect(index+1);
}
catch(System::Net::Sockets::SocketException^ e)
{
CLogWriterWrapper::getLogWriterWrapper()->WriteMessage(CLogWriterWrapper::MessTyp::Error,e->Message,
__FILE__,__FUNCTION__,__LINE__,gcnew Diagnostics::StackTrace(true),3);
MessageForm->writeLine(e->Message,CMessageForm::MessTyp::Error);
}
updateFromConnToView();
button1->Enabled = true;
}
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnClickButtOk(System::Object ^ sender, System::EventArgs ^ e)
{
Close();
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnClickButtCancel(System::Object ^ sender, System::EventArgs ^ e)
{
Close();
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnCheckedChangedRadButtServer(System::Object ^ sender, System::EventArgs ^ e)
{
int index;
if(listBoxInter->Items->Count > 0)
{
index = listBoxInter->SelectedIndex;
if(radioButtServer->Checked)
InterConnectionListe->getInterfaceAt(index+1)->setConnectionType(CConnectionInfo::ConnectionType::Server);
/*else
InterConnectionListe->getInterfaceAt(index+1)->setConnectionType(CConnectionInfo::ConnectionType::Client);*/
else
radioButtServer->Checked = (true);
radioButtClient->Checked = (false);
labTypeInfo->Text="Server";
}
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnCheckedChangedRadButtClient(System::Object ^ sender, System::EventArgs ^ e)
{
int index;
if(listBoxInter->Items->Count > 0)
{
index = listBoxInter->SelectedIndex;
if(radioButtClient->Checked)
InterConnectionListe->getInterfaceAt(index+1)->setConnectionType(CConnectionInfo::ConnectionType::Client);
/*else
InterConnectionListe->getInterfaceAt(index+1)->setConnectionType(CConnectionInfo::ConnectionType::Client);*/
else
radioButtClient->Checked = (true);
radioButtServer->Checked = (false);
labTypeInfo->Text="Client";
}
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnClickButtSave(System::Object ^ sender, System::EventArgs ^ e)
{
CAppSetting^ Sett = CAppSetting::getApp();
String^ directory = nullptr;
SaveFileDialog^ saveConnInfo = gcnew SaveFileDialog();
String^ path=nullptr;
CXmlInterConnInfoSave^ XmlInterConnInfoSave=nullptr;
saveConnInfo->Filter = "Interface Connection info(*.ici)|*.ici";
saveConnInfo->RestoreDirectory = true;
//Letze Pfad zum Verzeichnis auslesen
directory = Sett->getConnDirectory();
if(directory)
{
saveConnInfo->InitialDirectory = (directory);
}
if(saveConnInfo->ShowDialog() == ::DialogResult::OK)
{
path=saveConnInfo->FileName;
if(path != nullptr)
{
updateFromViewToConn();
XmlInterConnInfoSave = gcnew CXmlInterConnInfoSave(InterConnectionListe);
XmlInterConnInfoSave->saveConnectionInfo(path);
//updateConnListeView();
//Letze Pfad zum Verzeichnis merken
int pos = path->LastIndexOf("\\");
if(pos != -1)
{
directory = path->Substring(0,pos);
Sett->setConnDirectory(directory);
}
}
}
}
//-------------------------------------------------------------------------
System::Void CSocketConnectionForm::OnClickButtLoad(System::Object ^ sender, System::EventArgs ^ e)
{
CAppSetting^ Sett = CAppSetting::getApp();
String^ directory = nullptr;
CXmlInterConnInfoOpen^ reader=nullptr;
OpenFileDialog^ OpenModFile = gcnew OpenFileDialog();
System::String^ fileName;
OpenModFile->Title = "Open Connection Info";
OpenModFile->Filter="Interface Connection Info(*.ici)|*.ici";
//Letze Pfad zum Verzeichnis auslesen
directory = Sett->getConnDirectory();
if(directory)
{
OpenModFile->InitialDirectory = (directory);
}
if(OpenModFile->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
fileName=OpenModFile->FileName;
if(fileName != nullptr)
{
reader = gcnew CXmlInterConnInfoOpen(InterConnectionListe);
reader->readInterConnectionInfo(fileName);
updateFromConnToView();
//Letze Pfad zum Verzeichnis merken
int pos = fileName->LastIndexOf("\\");
if(pos != -1)
{
directory = fileName->Substring(0,pos);
Sett->setConnDirectory(directory);
}
}
}
}
//-------------------------------------------------------------------------
//---Delegate Methods------------------------------------------------------
void CSocketConnectionForm::setDelTreatmentRecConn(DelTreatmentRecConn^ trConn)
{
this->TreatmentRecConn = trConn;
}
//--------------------------------------------------------------------------
void CSocketConnectionForm::updateConnectionInfo(bool status)
{
int index = this->listBoxInter->SelectedIndex;
if(InterConnectionListe->isConnected(index+1))
MessageForm->writeLine("Connected!",CMessageForm::MessTyp::Info);
if(InterConnectionListe != nullptr)
{
if(InterConnectionListe->isConnected(index+1))
{
labStatusInfo->Text = "Connected";
labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Connected);
}
else
{
if(InterConnectionListe->isWaiting(index+1))
{
labStatusInfo->Text = "Waiting";
labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Waiting);
}
else
{
labStatusInfo->Text = "Disconnected";
labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
}
}
}
}
//--------------------------------------------------------------------------
//---Private Methods--------------------------------------------------------
//--------------------------------------------------------------------------
void CSocketConnectionForm::initInterfaceListe()
{
int count;
int index;
count = InterConnectionListe->getInterfaceCount();
for(int i=1;i<=count;i++)
{
listBoxInter->Items->Add(InterConnectionListe->getInterfaceName(i));
}
index = InterConnectionListe->getInterNummber(Interface);
index--;
if(index<0)
index=0;
if(listBoxInter->Items->Count > index)
listBoxInter->SelectedIndex = index;
}
//--------------------------------------------------------------------------
void CSocketConnectionForm::initCompConfiguration()
{
//DelIsConnected^ con = new DelIsConnected(this,&CSocketConnectionForm::updateConnectionInfo);
//radioButtServer->Checked = true;
Text = (InterConnectionListe->getDirection());
MessageForm->setShowModi(1);
MessageForm->Show();
}
//--------------------------------------------------------------------------
void CSocketConnectionForm::updateFromConnToView()
{
int index;
String^ hostName=nullptr;
String^ ipAddr=nullptr;
int port = 0;
CConnectionInfo::ConnectionType conType;
if(InterConnectionListe != nullptr)
{
index = listBoxInter->SelectedIndex;
if (index > -1)
{
chkBxLocHost->Checked = false;
InterConnectionListe->getHostInfo(index+1,hostName,ipAddr,&port);
if(hostName)
labHost->Text = hostName;
else
labHost->Text = "";
if(ipAddr)
comBxIpAddr->Text = ipAddr;
else
comBxIpAddr->Text = "";
if(port != -1)
txtBxPort->Text = System::Convert::ToString(port);
else
txtBxPort->Text = "";
conType = InterConnectionListe->getInterfaceAt(index+1)->getConnectionType();
if(conType == CConnectionInfo::ConnectionType::Server)
{
radioButtServer->Checked = true;
labTypeInfo->Text = "Server";
}
if(conType == CConnectionInfo::ConnectionType::Client)
{
radioButtClient->Checked = true;
labTypeInfo->Text = "Client";
}
if(conType == CConnectionInfo::ConnectionType::None)
{
radioButtServer->Checked = true;
InterConnectionListe->getInterfaceAt(index+1)->setConnectionType(CConnectionInfo::ConnectionType::Server);
labTypeInfo->Text = "Server";
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
}
//labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
if(InterConnectionListe->isConnected(index+1))
{
labStatusInfo->Text = "Connected";
//labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Connected);
}
else
{
if(InterConnectionListe->isWaiting(index+1))
{
labStatusInfo->Text = "Waiting";
//labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Waiting);
}
else
{
labStatusInfo->Text = "Disconnected";
//labTypeInfo->Text = InterConnectionListe->getConnType(index+1);
turnOnOffConnDisconnButtons(CConnectionInfo::ConnectionStatus::Disconnected);
}
}
}// if (index....
}// if(InterConnectionListe
}
//--------------------------------------------------------------------------
void CSocketConnectionForm::updateFromViewToConn()
{
int index;
int value;
index = listBoxInter->SelectedIndex;
if((labHost->Text) && (comBxIpAddr->Text))
{
try
{
value = System::Convert::ToInt32(txtBxPort->Text);
InterConnectionListe->setHostInfo(index+1,labHost->Text,comBxIpAddr->Text,value);
}
catch(...)
{
}
}
}
//--------------------------------------------------------------------------
void CSocketConnectionForm::turnOnOffConnDisconnButtons(String^ status)
{
if (status->Equals(CConnectionInfo::ConnectionStatus::Connected))
{
button1->Enabled = false;
button2->Enabled = true;
}
else if (status->Equals(CConnectionInfo::ConnectionStatus::Waiting))
{
button1->Enabled = false;
button2->Enabled = true;
}
else
{
button1->Enabled = true;
button2->Enabled = false;
}
} | [
"52784069+FrankilPacha@users.noreply.github.com"
] | 52784069+FrankilPacha@users.noreply.github.com |
494981ae3e0b885debe72f18aeba22bbf02320ed | 3c0d18b8723d67b8495eb6cb81d95d36341b573b | /Codeforces/Links and pearls.cpp | 9267786bc6a5c173ca0780868cd0d99bb74cda66 | [] | no_license | tahmid108/Tahmid-s-Codes | c3128b5b4843ad888e80b57a565739bc742a88ed | ff80ee6d9de4c961a55353b4ded447c6e9bd7431 | refs/heads/master | 2023-02-13T18:10:13.388262 | 2021-01-08T15:38:52 | 2021-01-08T15:38:52 | 327,944,373 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 332 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
long long count=0,count1=0;
getline(cin,s);
for(int i=0;i<s.size();i++)
{
if(s[i]=='-')
count++;
else if(s[i]=='o')
count1++;
}
if(count1==0){
cout<<"YES"<<endl;
return 0;
}
if(count%count1==0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
| [
"rahman1607108@stud.kuet.ac.bd"
] | rahman1607108@stud.kuet.ac.bd |
682d8b8cd1b693e2b12a82548e291b6958b7fc0d | 4af5e11cf315bfe10c74e8a20e09a85c8a6d2b45 | /src/genetic/individual.cc | aac2a7b624f46beba105f77e6d918929d9f0cdd7 | [] | no_license | qwazerty/genetic-smb-nes | 3594239d0fc8452f588b2dd01ac3055077c3b5cf | 5e27bcad814b191bc903cac24b48519cd22d23ba | refs/heads/master | 2016-09-05T16:26:18.260928 | 2013-05-14T05:15:12 | 2013-05-14T05:15:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,532 | cc | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <unistd.h>
#include <csignal>
#include "gene.hh"
#include "individual.hh"
#include "variables.hh"
Individual::Individual ()
{
for (int i = 0; i < 500; ++i)
genome_.push_back (Gene ());
}
Individual::Individual (std::vector<Gene> &genome)
{
for (Gene& g : genome)
g.evolve ();
}
Individual::Individual (const Individual &in)
{
for (int i = 0; i < 500; ++i)
genome_.push_back (in.genome_get (i));
score_ = in.score_get ();
}
Individual::Individual (Individual &i1, Individual &i2)
{
for (int i = 0; i < 500; ++i)
{
if (rand () % 100 <= PARENTS_RATE)
genome_.push_back (i1.genome_get (i));
else
genome_.push_back (i2.genome_get (i));
}
}
Individual::~Individual ()
{
}
int Individual::score_get () const
{
return score_;
}
Gene Individual::genome_get (int n) const
{
return genome_[n];
}
void Individual::mutate (int coef)
{
(void) coef;
for (Gene& g : genome_)
{
if (rand () % 100 < MUTATE_RATE)
{
g.evolve ();
}
}
}
void Individual::generate_lua (std::string file)
{
std::ofstream ofs (file);
ofs << "savestate.load(savestate.object(1))" << std::endl
<< "emu.speedmode(\"maximum\")" << std::endl
<< "local level = memory.readbyte(0x0760)" << std::endl
<< "newlevel = level" << std::endl
<< "state = 8" << std::endl << std::endl
<< "function on_exit ()" << std::endl
<< " emu.softreset()" << std::endl
<< "end" << std::endl
<< "emu.registerexit(on_exit)" << std::endl
<< "function print_score ()" << std::endl
<< " local score =" << std::endl
<< " (memory.readbyte(0x07dd) * 1000000)" << std::endl
<< " + (memory.readbyte(0x07de) * 100000)" << std::endl
<< " + (memory.readbyte(0x07df) * 10000)" << std::endl
<< " + (memory.readbyte(0x07e0) * 1000)" << std::endl
<< " + (memory.readbyte(0x07e1) * 100)" << std::endl
<< " + (memory.readbyte(0x07e2) * 10)" << std::endl
<< " + (memory.readbyte(0x006d) * 512)" << std::endl
<< " + (memory.readbyte(0x0086))" << std::endl
<< " .. \"\"" << std::endl
<< " emu.print(\"<score>\" .. score .. \"</score>\")" << std::endl
<< "end" << std::endl << std::endl;
int i = 0;
ofs << "table = {}" << std::endl;
for (Gene &g : genome_)
{
ofs << "table[" << i << "] = " << g.extract () << std::endl;
++i;
}
ofs << std::endl
<< "local i = 0" << std::endl
<< "local j = 0" << std::endl
<< "while (newlevel == level and (not (state == 11 or state == 0)))"
<< " do" << std::endl
<< " newlevel = memory.readbyte(0x0760)" << std::endl
<< " state = memory.readbyte(0x000e)" << std::endl
<< " joypad.set(1, table[i % 500])" << std::endl
<< " emu.frameadvance()" << std::endl
<< " j = (j + 1) % 20" << std::endl
<< " if (j == 0) then" << std::endl
<< " i = i + 1" << std::endl
<< " end" << std::endl
<< "end" << std::endl
<< "print_score ()" << std::endl;
}
std::thread Individual::spawn(int i)
{
return std::thread(&Individual::evaluate, this, i);
}
void Individual::evaluate (int i)
{
int result = 0;
int fd[2];
pid_t pid;
std::string str = std::string("smb" + std::to_string(i) + ".lua");
generate_lua(str);
pipe(fd);
if ((pid = fork ()) == 0)
{
close (fd[0]);
dup2 (fd[1], STDOUT_FILENO);
execl ("./bin/unbuffer", "unbuffer", "./bin/fceux",
"smb.zip", "--loadlua", str.c_str(), NULL);
perror ("fork");
}
else
{
close (fd[1]);
char buf[1];
std::string res;
while(read(fd[0], buf, 1) > 0)
{
res.push_back (buf[0]);
if (res.find ("</score>") != std::string::npos)
{
kill (pid, SIGKILL);
res.erase (0, res.find ("<score>") + 7);
res.erase (res.find ("</score>"));
std::stringstream strs (res);
if (!(strs >> result))
result = 0;
}
}
close (fd[0]);
}
score_ = result;
std::cout << "Current test: " << score_ << std::endl;
}
| [
"precursor.qwaz@hotmail.fr"
] | precursor.qwaz@hotmail.fr |
6aed645df15f7bec1364aa1205b7ccc1a1c242e2 | b6526dbf7f28598b0a228d4bacc66dfde9d1c2e7 | /preorderTraversal/preorderTraversal.cpp | ccd17c1c4ffc233203fa8b4feb0b3fc9f58d2380 | [] | no_license | zzfan/leetCode | 421d2250502891871933cde5b73d9d3339b0d471 | 64f5cf7ddb73a892ffbd0bf8dfddd03c2e7493cd | refs/heads/master | 2020-05-30T14:46:00.828283 | 2016-09-07T02:58:23 | 2016-09-07T02:58:23 | 56,552,920 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,263 | cpp | /*************************************************************************
> File Name: preorderTraversal.cpp
> Author: zzfan
> Mail: zzfan@mail.ustc.edu.cn
> Created Time: Wed 08 Jun 2016 06:00:58 PM HKT
************************************************************************/
#include <iostream>
#include <vector>
using namespace std;
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x): val(x), left(NULL), right(NULL) {}
};
//递归算法
vector<int> preorder(TreeNode* root, vector<int> path)
{
if(root != NULL){
path.push_back(root->val);
preorder(root->left, path);
preorder(root->right, path);
}
}
vector<int> preorderTraversal1(TreeNode* root)
{
vector<int> path;
preorder(root, path);
return path;
}
//非递归算法,迭代
vector<int> preorderTraversal(TreeNode* root)
{
vector<int> path;
stack<TreeNode*> stk;
while(root != NULL || !stk.empty()){
if(root != NULL){
while(root){
path.push_back(root->val);
stk.push(root);
root = root->left;
}
}
else{
root = stk.top()->right;
stk.pop();
}
}
return path;
}
| [
"zzfan@mail.ustc.edu.cn"
] | zzfan@mail.ustc.edu.cn |
b8def156252698f695dc8ab637cc6542ee8a6989 | a2ba072a87ab830f5343022ed11b4ac365f58ef0 | / urt-bumpy-q3map2 --username twentyseven@urbanterror.info/libs/entitylib.cpp | c58a7dcdf43e1367951ad56ab04d056eccbf9c34 | [] | no_license | Garey27/urt-bumpy-q3map2 | 7d0849fc8eb333d9007213b641138e8517aa092a | fcc567a04facada74f60306c01e68f410cb5a111 | refs/heads/master | 2021-01-10T17:24:51.991794 | 2010-06-22T13:19:24 | 2010-06-22T13:19:24 | 43,057,943 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 26 | cpp |
#include "entitylib.h"
| [
"twentyseven@urbanterror.info"
] | twentyseven@urbanterror.info |
1740bbfaaa9a06bc84ceafb90aaf7f3b3c2cc265 | d65f80d89a30f2c9dc7663684ed7b724124ff7e5 | /src/geom/Shape/Quad.h | eac86e7755e0bfd60d084cc680933ab9f8d8e1d1 | [
"Zlib"
] | permissive | Alan-FGR/mud | e53313bef4ed7f5785af99d19134d806743f4fe8 | 7186841f9b33d0f95eda6798508906ca54318bd0 | refs/heads/master | 2020-03-19T08:17:29.188638 | 2018-06-05T14:37:35 | 2018-06-05T14:37:35 | 136,191,736 | 0 | 0 | null | 2018-06-05T14:42:32 | 2018-06-05T14:42:32 | null | UTF-8 | C++ | false | false | 818 | h | // Copyright (c) 2018 Hugo Amiard hugo.amiard@laposte.net
// This software is provided 'as-is' under the zlib License, see the LICENSE.txt file.
// This notice and the license may not be removed or altered from any source distribution.
#pragma once
#include <geom/Generated/Forward.h>
#include <geom/Shape/ProcShape.h>
namespace mud
{
MUD_GEOM_EXPORT void quad_vertices(const ProcShape& shape, const Quad& quad, MeshData& data);
MUD_GEOM_EXPORT ShapeSize size_shape_lines(const ProcShape& shape, const Quad& quad);
MUD_GEOM_EXPORT void draw_shape_lines(const ProcShape& shape, const Quad& quad, MeshData& data);
MUD_GEOM_EXPORT ShapeSize size_shape_triangles(const ProcShape& shape, const Quad& quad);
MUD_GEOM_EXPORT void draw_shape_triangles(const ProcShape& shape, const Quad& quad, MeshData& data);
}
| [
"hugo.amiard@laposte.net"
] | hugo.amiard@laposte.net |
28ad3a75d73bddbf7cdbae79435ea4321e7131e0 | 28e9f79335a6e88ea9a020f80f24e0f715b64ad7 | /dependencies/framework/GL_core_tools/source/texture.cpp | 90c51ce88a4c488fc8aebdc83f83bd439a9a71b5 | [
"MIT"
] | permissive | crest01/ShapeGenetics | 701a0702dacb38660da3471bd187f590edfc3c5e | 7321f6484be668317ad763c0ca5e4d6cbfef8cd1 | refs/heads/master | 2021-01-12T01:59:29.067964 | 2019-05-20T21:08:47 | 2019-05-20T21:08:47 | 78,453,093 | 18 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,787 | cpp |
#include "error.h"
#include "texture.h"
namespace GL
{
GLuint TextureObjectNamespace::gen()
{
GLuint id;
glGenTextures(1, &id);
checkError();
return id;
}
void TextureObjectNamespace::del(GLuint name)
{
glDeleteTextures(1, &name);
checkError();
}
Texture createTexture2D(GLsizei width, GLsizei height, GLint levels, GLenum format)
{
Texture tex;
glBindTexture(GL_TEXTURE_2D, tex);
glTexStorage2D(GL_TEXTURE_2D, levels, format, width, height);
checkError();
return tex;
}
Texture createTexture2DArray(GLsizei width, GLsizei height, GLint slices, GLint levels, GLenum format)
{
Texture tex;
glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
glTexStorage3D(GL_TEXTURE_2D_ARRAY, levels, format, width, height, slices);
checkError();
return tex;
}
Texture createTexture2DMS(GLsizei width, GLsizei height, GLenum format, GLsizei samples)
{
Texture tex;
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, format, width, height, GL_FALSE);
checkError();
return tex;
}
Texture createTexture3D(GLsizei width, GLsizei height, GLsizei depth, GLint levels, GLenum format)
{
Texture tex;
glBindTexture(GL_TEXTURE_3D, tex);
glTexStorage3D(GL_TEXTURE_3D, levels, format, width, height, depth);
checkError();
return tex;
}
Texture createTextureCube(GLsizei width, GLint levels, GLenum format)
{
Texture tex;
glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
glTexStorage2D(GL_TEXTURE_CUBE_MAP, levels, format, width, width);
checkError();
return tex;
}
GLuint SamplerObjectNamespace::gen()
{
GLuint id;
glGenSamplers(1, &id);
checkError();
return id;
}
void SamplerObjectNamespace::del(GLuint name)
{
glDeleteSamplers(1, &name);
checkError();
}
}
| [
"karl.haubenwallner@student.tugraz.at"
] | karl.haubenwallner@student.tugraz.at |
d6f711f322620e1f2991f1b9c295743172b095f6 | 92095ddf166b17c30ec1b4c0f179be5f36f8df60 | /DS6/BigInteger/BigIntegerInVector.h | 7eac1528939e9bf0e946f048e2dafdb2455f0065 | [] | no_license | blackeywong/DataStructure | d9adb065ea1fdf3fcc20b8dd58da223c37578542 | a158d8dd69ac58f53fd237e9c4d50441dbd9b682 | refs/heads/master | 2021-05-23T00:10:01.029878 | 2020-08-04T06:07:04 | 2020-08-04T06:07:04 | 253,150,081 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,999 | h | #pragma once
#ifndef _BIGINTEGERINVECTOR_H
#define _BIGINTEGERINVECTOR_H
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
//数据结构算法与应用-C++语言描述 第六章
//Exercise 69
//use vector to store digits of every digit. sign: 1(positive) or -1(negative)
class BigInteger {
public:
BigInteger() { digits = new vector<int>;}
BigInteger(const string& number);
BigInteger(const BigInteger& other):BigInteger() { copyData(other);}
~BigInteger() { delete digits; }
BigInteger& operator=(const BigInteger& other) { copyData(other); return *this; }
bool operator==(const BigInteger& right) const { return equals(right); }
bool operator!=(const BigInteger& right) const { return ! equals(right); }
bool operator<(const BigInteger& right) const { return lessThan(right); }
bool operator<=(const BigInteger& right) const { return lessThan(right) || equals(right); }
bool operator>(const BigInteger& right) const { return right.lessThan(*this); }
bool operator>=(const BigInteger& right) const { return right.lessThan(*this) || right.equals(*this); }
BigInteger& operator+=(const BigInteger& right);
BigInteger& operator-=(const BigInteger& right);
BigInteger& operator*=(const BigInteger& right);
BigInteger& operator/=(const BigInteger& right);
BigInteger& operator%=(const BigInteger& right);
void output(ostream& out) const;
public:
void copyData(const BigInteger& other);
bool equals(const BigInteger& right) const;
bool lessThan(const BigInteger& right) const;
protected:
//helper func. add/minus digits only, ignore sign.
void add(const BigInteger& right);
void minus(const BigInteger& right);
BigInteger multiply(const BigInteger& right);
void divide(const BigInteger& right, BigInteger& quotient, BigInteger& remainder);
bool lessThanIgnoreSign(const BigInteger& right) const;
vector<int>* digits;
int sign;//1(positive) or -1(negative)
};
ostream& operator<<(ostream& out, BigInteger& bi);
#endif | [
"blackeywong@hotmail.com"
] | blackeywong@hotmail.com |
a4032bdc71bffe2870e694fb3209bf078ad692fa | a06c382657910483ba6af54efaf3ce0779ed39ad | /src/ED/TXYZ-save.cpp | 67f7306dc9b74920fce1d05350ea0d4d4d652cdc | [] | no_license | chaeyeunpark/are-neural-quantum-states-good | 8d546312ee5976df7ddd5d6ab4bb851329599140 | a37ba05856d33f648c78351a38c1517f8233f978 | refs/heads/main | 2023-07-14T18:13:00.312904 | 2021-09-01T21:10:14 | 2021-09-01T21:10:14 | 361,696,144 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,032 | cpp | #include <iostream>
#include <fstream>
#include <ios>
#include <cereal/archives/binary.hpp>
#include <tbb/tbb.h>
#include "ParallelMV.hpp"
#include "Basis/TIBasisZ2.hpp"
#include "TITXYZ.hpp"
#include "TITXYZSto.hpp"
#include "ArpackSolver.hpp"
int main(int argc, char* argv[])
{
int N;
if(argc != 2)
{
printf("Usage: %s [N]\n", argv[0]);
return 1;
}
sscanf(argv[1], "%d", &N);
char* tbb_num_threads = std::getenv("TBB_NUM_THREADS");
int num_threads = 0;
if((tbb_num_threads != nullptr) && (tbb_num_threads[0] != '\0'))
{
num_threads = atoi(tbb_num_threads);
}
if(num_threads <= 0)
num_threads = tbb::this_task_arena::max_concurrency();
std::cerr << "Set number of threads: " << num_threads << std::endl;
tbb::global_control gc(tbb::global_control::max_allowed_parallelism, num_threads);
std::cout << "#N: " << N << std::endl;
using UINT = uint64_t;
using INT = int64_t;
double J1 = 1.0;
using Basis = TIBasisZ2<UINT>;
Basis basis(N, 0, false, 1);
std::vector<std::pair<double, double>> params;
for(uint32_t k = 0; k < 11; ++k)
{
double a = 0.5 - 0.01*k;
double b = 2.0 + 0.1*k;
params.emplace_back(a, b);
}
std::cout << "#dimensions: " << basis.getDim() << std::endl;
for(const auto [a,b]: params)
{
TITXYZSto<UINT> ham(basis, a, b);
const uint32_t dim = basis.getDim();
ParallelMV mv(dim, ham);
ArpackSolver<ParallelMV> solver(mv, dim);
if(solver.solve(2) != ErrorType::NormalExit)
{
std::cerr << "error processing (a,b): (" << a << ", " <<
b << ")" << std::endl;
return 1;
}
auto evals = solver.eigenvalues();
auto evecs = solver.eigenvectors();
printf("%f\t%f\t%.12f\t%.12f\t\n", a, b, evals(0), evals(1));
char fileName[255];
sprintf(fileName, "GS_1DTXYZ_A%03d_B%03d.dat", int(100*a + 0.5), int(100*b + 0.5));
{
std::ofstream fout(fileName, std::ios::binary);
fout.write((const char*)&dim, sizeof(dim));
fout.write((const char*)evecs.data(), dim*sizeof(double));
fout.close();
}
fflush(stdout);
}
return 0;
}
| [
"kaeri17@gmail.com"
] | kaeri17@gmail.com |
3c35df3c654fee98e292b77e43a70567b2cf3de3 | a6094c9c6d19a0878eb379bb8f8b09243072ba73 | /lmm-p2654-Accepted-s546832.cpp | 20d626b7af40cfa1f5b44a5a682021eb7d3ee10a | [] | no_license | pedris11s/coj-solutions | c6b0c806a560d1058f32edb77bc702d575b355c3 | e26da6887109697afa4703f900dc38a301c94835 | refs/heads/master | 2020-09-26T07:25:40.728954 | 2019-12-05T22:51:07 | 2019-12-05T22:51:07 | 226,202,753 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 295 | cpp | #include <iostream>
using namespace std;
const int C[2] = {4, 7};
int main()
{
int K;
cin >> K;
int e = 1;
while ((1 << e) - 2 < K)
e++;
e--;
K -= ((1 << e) - 1);
for (int i = e - 1 ; i > -1 ; i--)
cout << C[((1 << i) & K) != 0];
return 0;
} | [
"ptorres@factorclick.cl"
] | ptorres@factorclick.cl |
f59e06f275396b398914ab2e06641a4dc9ad99f6 | 65e68eb4601830bc2a519ce5bbf31fd385dc84db | /blue-iron-greyhound/BackgroundMusicComponent.h | e87e35e8cece32acd96636e1ee6bee0d6b5d2a03 | [] | no_license | Cmadden09/Year-3-Games-Project | 00225f55e8ba64e75d5cfee267628b9f570a2686 | 143a50e51eaa0f0698be9e78c7d084cfc72b85dd | refs/heads/master | 2020-04-21T21:55:42.838305 | 2019-02-10T11:36:33 | 2019-02-10T11:36:33 | 169,894,410 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 513 | h | #pragma once
#include "GameObject.h"
#include "Component.h"
#include "IrrKlangAudioSystem.h"
class BackgroundMusicComponent : public Component
{
public:
BackgroundMusicComponent() {}
BackgroundMusicComponent(std::string name);
~BackgroundMusicComponent() {};
void init();
void update(double dt);
void setAudio(IrrKlangAudioSystem *newAudio) { this->audio = newAudio; }
void setAudioPath(char* newAudioPath) { this->audioPath = newAudioPath; }
private:
IrrKlangAudioSystem *audio;
char* audioPath;
}; | [
"chloe_madden@live.com"
] | chloe_madden@live.com |
73aa6000aad64ab3a36641b8fa673adbc88d4e3b | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/git/gumtree/git_new_hunk_317.cpp | 6db7d1d5d898aae16a9f59154d2799c7bbbce6e6 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 708 | cpp | #include "cache.h"
#include "builtin.h"
#include "parse-options.h"
#include "lockfile.h"
#include "apply.h"
static const char * const apply_usage[] = {
N_("git apply [<options>] [<patch>...]"),
NULL
};
static struct lock_file lock_file;
int cmd_apply(int argc, const char **argv, const char *prefix)
{
int force_apply = 0;
int options = 0;
int ret;
struct apply_state state;
if (init_apply_state(&state, prefix, &lock_file))
exit(128);
argc = apply_parse_options(argc, argv,
&state, &force_apply, &options,
apply_usage);
if (check_apply_state(&state, force_apply))
exit(128);
ret = apply_all_patches(&state, argc, argv, options);
clear_apply_state(&state);
return ret;
| [
"993273596@qq.com"
] | 993273596@qq.com |
4214fc19e622872590cc334e65bfe306e88c5830 | 3efc50ba20499cc9948473ee9ed2ccfce257d79a | /data/code-jam/files/32016_ziyu_24484_1_extracted_product.cpp | fc0b675ff18b32551e9dc80f9b06f0d8bffe982b | [] | no_license | arthurherbout/crypto_code_detection | 7e10ed03238278690d2d9acaa90fab73e52bab86 | 3c9ff8a4b2e4d341a069956a6259bf9f731adfc0 | refs/heads/master | 2020-07-29T15:34:31.380731 | 2019-12-20T13:52:39 | 2019-12-20T13:52:39 | 209,857,592 | 9 | 4 | null | 2019-12-20T13:52:42 | 2019-09-20T18:35:35 | C | UTF-8 | C++ | false | false | 573 | cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int casenum;
cin>>casenum;
int n;
vector<long long >v1;
vector<long long>v2;
int cnt = 0;
while(casenum--){
cin>>n;
v1 = v2 = vector<long long >(n,0);
for(int i=0;i<n;++i){
cin>> v1[i];
}
for(int i=0;i<n;++i){
cin>> v2[i];
}
sort(v1.begin(),v1.end());
sort(v2.begin(),v2.end());
long long product = 0;
for(int i=0;i<n;++i){
product += v1[i]*v2[n-i-1];
}
cout<<"Case #"<<++cnt<<": "<<product<<endl;
}
return 0;
}
| [
"arthurherbout@gmail.com"
] | arthurherbout@gmail.com |
1098be670e646710fc657e18116a9da2aec6e37e | eb7967adbd7bcb3fd5ba79a7a6fe2462d3fe05e9 | /RootAna_CMEbias/checkTrack/checkTrack/MyxAODAnalysis.h | 9175b9f32b9c35fd8e698352bc61ff54b9b98a7c | [] | no_license | MingliangZhou/PhD_ProdCode | 40c1428c81df5ff78493cb037b3aa5fe8fc1e2a7 | 369c8f98d686179a9408665b68b47a302906d248 | refs/heads/master | 2020-04-27T15:01:03.875244 | 2019-03-08T00:00:33 | 2019-03-08T00:00:33 | 174,428,812 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,252 | h | #ifndef checkTrack_MyxAODAnalysis_H
#define checkTrack_MyxAODAnalysis_H
#include <EventLoop/Algorithm.h>
// include files for using the trigger tools
#include "TrigConfxAOD/xAODConfigTool.h"
#include "TrigDecisionTool/TrigDecisionTool.h"
#include "xAODRootAccess/Init.h"
#include "xAODRootAccess/TEvent.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "xAODTracking/VertexContainer.h"
#include "TH1.h"
#include "TH2.h"
#include "TProfile.h"
#include "TFile.h"
#include "TTree.h"
class MyxAODAnalysis : public EL::Algorithm
{
// put your configuration variables here as public variables.
// that way they can be set directly from CINT and python.
public:
// trigger tools member variables
Trig::TrigDecisionTool *m_trigDecisionTool; //!
TrigConf::xAODConfigTool *m_trigConfigTool; //!
const xAOD::Vertex *vertexParticle(const xAOD::TrackParticle*);
xAOD::TEvent *m_event; //!
int m_eventCounter; //!
unsigned int eventID; //!
TFile *fout; //!
TTree *tree; //!
TH2F* hForeAll[50][10][5][5]; //!
TH2F* hForePos[50][10][5][5]; //!
TH2F* hForeNeg[50][10][5][5]; //!
TH2F* hMixdAll[50][10][5][5]; //!
TH2F* hMixdPos[50][10][5][5]; //!
TH2F* hMixdNeg[50][10][5][5]; //!
TH2F* hEtaAchgAll; //!
TH2F* hEtaAchgPos; //!
TH2F* hEtaAchgNeg; //!
TH2F* hPtAchgAll; //!
TH2F* hPtAchgPos; //!
TH2F* hPtAchgNeg; //!
TH2F* hPtAchgAllCnt; //!
TH2F* hPtAchgPosCnt; //!
TH2F* hPtAchgNegCnt; //!
int tagEta; //!
int tagPhi; //!
char nameTrig[100]; //!
std::vector<float> mixWeiAll; //!
std::vector<float> mixWeiPos; //!
std::vector<float> mixWeiNeg; //!
std::vector<float> mixEtaAll; //!
std::vector<float> mixEtaPos; //!
std::vector<float> mixEtaNeg; //!
std::vector<float> mixPhiAll; //!
std::vector<float> mixPhiPos; //!
std::vector<float> mixPhiNeg; //!
std::vector< std::vector<float> > poolWeiAll[50][10]; //!
std::vector< std::vector<float> > poolWeiPos[50][10]; //!
std::vector< std::vector<float> > poolWeiNeg[50][10]; //!
std::vector< std::vector<float> > poolEtaAll[50][10]; //!
std::vector< std::vector<float> > poolEtaPos[50][10]; //!
std::vector< std::vector<float> > poolEtaNeg[50][10]; //!
std::vector< std::vector<float> > poolPhiAll[50][10]; //!
std::vector< std::vector<float> > poolPhiPos[50][10]; //!
std::vector< std::vector<float> > poolPhiNeg[50][10]; //!
int RunNo; //!
int LbNo; //!
int Bcid; //!
float Trigger[7]; //!
float VtxZ; //!
float FcalA; //!
float FcalC; //!
float QxA[3]; //!
float QxC[3]; //!
float QyA[3]; //!
float QyC[3]; //!
int MbtsHitA; //!
int MbtsHitC; //!
float MbtsTimeA; //!
float MbtsTimeC; //!
float GapA; //!
float GapC; //!
float ZdcA; //!
float ZdcC; //!
int Topo; //!
int TopoEta[50]; //!
float TrkRef; //!
float TrkEff; //!
float TrkAll; //!
float TrkPos; //!
float TrkNeg; //!
float TrkDeltaEtaAll[50]; //!
float TrkDeltaEtaPos[50]; //!
float TrkDeltaEtaNeg[50]; //!
float TrkDeltaPhiAll[50]; //!
float TrkDeltaPhiPos[50]; //!
float TrkDeltaPhiNeg[50]; //!
float TrkDeltaEtaAllMix[50]; //!
float TrkDeltaEtaPosMix[50]; //!
float TrkDeltaEtaNegMix[50]; //!
float TrkDeltaPhiAllMix[50]; //!
float TrkDeltaPhiPosMix[50]; //!
float TrkDeltaPhiNegMix[50]; //!
public:
// Tree *myTree; //!
// TH1 *myHist; //!
// this is a standard constructor
MyxAODAnalysis ();
// these are the functions inherited from Algorithm
virtual EL::StatusCode setupJob (EL::Job& job);
virtual EL::StatusCode fileExecute ();
virtual EL::StatusCode histInitialize ();
virtual EL::StatusCode changeInput (bool firstFile);
virtual EL::StatusCode initialize ();
virtual EL::StatusCode execute ();
virtual EL::StatusCode postExecute ();
virtual EL::StatusCode finalize ();
virtual EL::StatusCode histFinalize ();
// this is needed to distribute the algorithm to the workers
ClassDef(MyxAODAnalysis, 1);
};
#endif
| [
"MingliangZhou@Mingliangs-MacBook-Pro.local"
] | MingliangZhou@Mingliangs-MacBook-Pro.local |
05cf90c55ea91eede1686d2499a421990f316f64 | 0e487326b48e85a6c82ed922e41b13dee30f67a5 | /SBFT/threshsign/bench/lib/IThresholdSchemeBenchmark.h | 6f0997408c0b3d59a154829acdf7d0e2011eb512 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | pyruvic-acid/Polaris | f21bf75190b0f68d5e4f00197c961c91e631c546 | 5acb68deaa46e6c63a21fff0c0115480fb127454 | refs/heads/master | 2020-12-31T23:03:07.207748 | 2020-02-09T05:36:08 | 2020-02-09T05:36:08 | 239,066,728 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,360 | h | // Concord
//
// Copyright (c) 2018 VMware, Inc. All Rights Reserved.
//
// This product is licensed to you under the Apache 2.0 license (the "License").
// You may not use this product except in compliance with the Apache 2.0 License.
//
// This product may include a number of subcomponents with separate copyright
// notices and license terms. Your use of these subcomponents is subject to the
// terms and conditions of the subcomponent's license, as noted in the
// LICENSE file.
#pragma once
#include <string>
#include <ostream>
#include <set>
#include <stdexcept>
#include "Timer.h"
#include "threshsign/ThresholdSignaturesTypes.h"
#include "threshsign/VectorOfShares.h"
#include "threshsign/IPublicParameters.h"
class IThresholdSchemeBenchmark {
protected:
const IPublicParameters& params;
int skBits, pkBits;
int sigBits;
int sigShareBits;
NumSharesType numSigners; // total number of signers
NumSharesType reqSigners; // required number of threshold signers
bool started;
int numBenchIters;
int msgSize;
unsigned char * msg; // Message that will be signed
AveragingTimer
hashT, // hashing the message to be signed
sigT, // a single signing op under the non-threshold scheme (e.g., normal BLS) w/o hashing overhead
verT, // a single verification op under the non-threshold scheme (e.g., normal BLS) w/o hashing overhead
sshareT, // a single share signing op under the threshold scheme
vshareT, // verifying a signature share
pairT, // computing a pairing, if applicable (e.g., in BLS)
lagrangeCoeffT, // computing the Lagrange coefficients
lagrangeExpT, // exponentiating the sig shares with Lagrange coeffs
aggT; // aggregating the signature shares, once the coefficients are computed
bool hasPairing;
bool hasShareVerify;
public:
IThresholdSchemeBenchmark(const IPublicParameters& p, int k, int n, int msgSize = 64);
virtual ~IThresholdSchemeBenchmark();
public:
void start();
// Compute a pairing (bilinear map)
virtual void pairing() = 0;
virtual void hash() = 0;
virtual void signSingle() = 0;
virtual void verifySingle() = 0;
/**
* WARNING: Players are indexed from 1 to N, inclusively. This is because
* each player gets their share i as the evaluation p(i) of the polynomial p(.)
* at point i. Since the shared secret key is stored in p(0) no player can have identity 0.
* (or if they do, then identities need to be mapped to points x_i such that player
* i's share becomes p(x_i) rather than p(i))
*/
virtual void signShare(ShareID i) = 0;
virtual void verifyShares() = 0;
virtual void accumulateShares(const VectorOfShares& signers) = 0;
virtual void computeLagrangeCoeff(const VectorOfShares& signers) = 0;
virtual void exponentiateLagrangeCoeff(const VectorOfShares& signers) = 0;
virtual void aggregateShares(const VectorOfShares& signers) = 0;
virtual void sanityCheckThresholdSignature(const VectorOfShares& signers) = 0;
void printResults(std::ostream& out);
void printHeaders(std::ostream& out);
virtual void printExtraHeaders(std::ostream& out) { (void)out; }
void printNumbers(std::ostream& out);
virtual void printExtraNumbers(std::ostream& out) { (void)out; }
};
| [
"CH3COCOOH@protonmail.com"
] | CH3COCOOH@protonmail.com |
20b57ee8b61ef0e3064c1c018c2edeb8d21e3a89 | 684ce0a66322b0a6ea8b729c8a9822109d69f31d | /UVAOJ/101.cpp | 6bff33e2f72fff8b6185f75416f8dff91c5908b2 | [] | no_license | w0lker/ACM | b4c53c389b66e7522feb6fe8f9bd0dee3140db3a | 7d70350d03588fdf5e13c68478f91ec1e46613b4 | refs/heads/master | 2020-12-11T05:23:28.112483 | 2014-02-14T04:48:11 | 2014-02-14T04:48:11 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,286 | cpp | /**
基本实现功能了,但是运行时间太长。
**/
#include <iostream>
#include <vector>
#include <string>
#include <map>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::string;
using std::map;
struct Block{
Block(int i):num(i),up(NULL),down(NULL){}
int num;
Block *up;
Block *down;
};
struct Pile{
Pile(Block *b):top(b),bottom(b){}
Block *top;
Block *bottom;
void pop(){
if(top==NULL) return;
else if(top==bottom){top=NULL;bottom=NULL;}
else{
top->down->up=NULL;
top = top->down;
}
}
void push(Block *blk){
if(top==NULL) {
blk->up=NULL;
blk->down=NULL;
top=blk;
bottom=blk;}
else{
blk->down=top;
top->up=blk;
top=blk;
}
}
};
vector<Pile> piles;
vector<Block> blocks;
map<int,int> index;
void pop_blocks(Block *blk){
int p=index[blk->num];
if(blk->down!=NULL){
blk->down->up=NULL;
piles[p].top=blk->down;
}else{
piles[p].top=NULL;
piles[p].bottom=NULL;
}
}
void push_blocks(Block *blk_a,Block *blk_top,int p){
Block *ptr=blk_a;
while(ptr!=NULL){
index[ptr->num]=p;
ptr=ptr->up;
}
if(piles[p].top==NULL){
blk_a->down=NULL;
piles[p].top=blk_top;
piles[p].bottom=blk_a;
}else{
blk_a->down=piles[p].top;
piles[p].top->up=blk_a;
piles[p].top=blk_top;
}
}
void move_onto(int a,int b){
int p_a=index[a];
int p_b=index[b];
while(a!=(piles.at(p_a).top->num)){
int init_loca=piles.at(p_a).top->num;
piles.at(p_a).pop();
piles.at(init_loca).push(&blocks[init_loca]);
}
while(b!=(piles.at(p_b).top->num)){
int init_loca=piles.at(p_b).top->num;
piles.at(p_b).pop();
piles.at(init_loca).push(&blocks[init_loca]);
}
if(a!=(piles.at(p_a).top->num) && b!=(piles.at(p_b).top->num)){cout<<"不可能"<<endl;}
piles.at(p_a).pop();
piles.at(p_b).push(&blocks.at(a));
index[a]=p_b;
}
void move_over(int a,int b){
int p_a=index[a];
int p_b=index[b];
while(a!=(piles.at(p_a).top->num)){
int init_loca=piles.at(p_a).top->num;
piles.at(p_a).pop();
piles.at(init_loca).push(&blocks[init_loca]);
index[init_loca]=init_loca;
if(init_loca==b) p_b=init_loca;
}
move_onto(a,piles.at(p_b).top->num);
}
void pile_onto(int a,int b){
int p_a=index[a];
int p_b=index[b];
while(b!=(piles.at(p_b).top->num)){
int init_loca=piles.at(p_b).top->num;
piles.at(p_b).pop();
piles.at(init_loca).push(&blocks[init_loca]);
}
int top_num=piles.at(p_a).top->num;
pop_blocks(&blocks[a]);
push_blocks(&blocks[a],&blocks[top_num],p_b);
}
void pile_over(int a,int b){
int top_num=piles.at(index[b]).top->num;
pile_onto(a,top_num);
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
Block block(i);
blocks.push_back(block);
}
for(int i=0;i<n;i++){
Pile pile(&blocks.at(i));
piles.push_back(pile);
index[i]=i;
}
int a,b;
string s1,s2;
while(true){
cin>>s1;
if(!s1.compare("quit")) break;
cin>>a>>s2>>b;
if(a==b) continue;
if(s1.compare("move")==0){
if(s2.compare("onto")==0) move_onto(a,b);
else move_over(a,b);
}else{
if(s2.compare("onto")==0) pile_onto(a,b);
else pile_over(a,b);
}
}
for(int i=0;i<n;++i){
cout<<i<<":";
Block *ptr=piles.at(i).bottom;
while(ptr!=NULL){
cout<<" "<<ptr->num;
ptr=ptr->up;
}
cout<<endl;
}
return 0;
} | [
"dlut200803001@163.com"
] | dlut200803001@163.com |
0f794357a56b20b8fbcc6162d0d0ee1f15522e0c | 21dd586bcdcacda1ad925fbf5c911ab1124491ce | /src/parser.cpp | f1ba7d206fe8f6fda126b274bfe072aa614c86e1 | [] | no_license | Uriegas/Moodle_C- | f2bb4b9bdbbfdf1dc128ffa69f8dd1534837e849 | ec27f921cb552db6e55a1ff652da2bc8cf3f4c02 | refs/heads/master | 2022-11-27T03:15:44.757158 | 2020-08-11T00:35:12 | 2020-08-11T00:35:12 | 278,945,324 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,605 | cpp | #include "../include/parser.h"
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<COMMENTS SECTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Author: Jesus Eduardo Uriegas Ibarra
//Lexer_Token Parser -> String Formula Analyzer
//The code is divided into:
//Enums and Struct
//Support functions
//lexer_part_1 function tokenizer
//lexer_part_2 function error handling
//lexer_part_3 function treat functions
//lexer function combining 3 lexer parts
//Parser function Infix to Postfix Notation
//Evaluate function Postfix to Result
//Main function
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER PART 1 FUNCTIONS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//All of this are bool functions implemented in the lexical analyzer function
bool operator==(const tokens& compare1, const tokens compare2){
if((compare1.ID == compare2.ID) && (compare1.value == compare2.value))
return true;
else
return false;
}
bool is_a_number(const char& letter){ //Consider '.' as a number for make easier to save float numbers
if(letter == '1' || letter == '2' || letter == '3' || letter == '4' || letter == '5' ||
letter == '6' || letter == '7' || letter == '8' || letter == '9' || letter == '0' || letter == '.'){
return true;
}
else{
return false;
}
}
bool is_a_separator(const char& letter){
if(letter == ',' || letter == '{' || letter == '}' || letter == '_'){// '_' case is for the - sign in negative numbers
return true;
}
else{
return false;
}
}
bool is_a_parenthesis(const char& letter){
if(letter == '(' || letter == ')'){//Special case because there are to types of parenthesis
return true;
}
else{
return false;
}
}
bool is_an_operator(const char& letter) {//There are not unary operators here
if(letter == '*' || letter == '/' || letter == '+' ||
letter == '-' || letter == '%'){
return true;
}
else{
return false;
}
}
//Just a function that returns a token when it found an special character
tokens select_special_character(const char& a){
tokens res;
std::string ch;
switch (a){
case '{':
res = {OPEN_VAR, (ch += a)};
break;
case '}':
res = {CLOSE_VAR, (ch += a)};
break;
case ',':
res = {SEPARATOR, (ch += a)};
break;
default:
break;
}
return res;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER PART 2 FUNCTIONS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Prints the kind of error
void return_error(const int& err){
switch (err){
case SYNTAXERROR:
std::cout << "Syntax Error, maybe a bad operand input";
break;
case MISSING_VARIABLE:
std::cout << "Error in variable name, you should enter just letters and numbers in it";
break;
case MISSING_BRACKET:
std::cout << "Missing bracket: '{' or '}'";
break;
case MISSING_PARENTHESIS:
std::cout << "Missing parenthesis '(' or ')'";
break;
case MISSING_COMMA:
std::cout << "Error in function parameters, maybe there is a missing comma or closing parenthesis";
break;
case MISSING_FUNCTION:
std::cout << "Misspelling in function prototype, this function does not exist";
break;
default:
std::cout << "There is no error";
break;
}
std::cout << "\n";
}
//To future implementation
std::string evaluate_negative_sign(){}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER PART 3 FUNCTIONS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Currently there are 3 binary function
bool is_binary_function(const tokens& function){
if(function.value == "pow" || function.value == "fmod" || function.value == "round" || function.value == "atan2")
return true;
else
return false;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER FUNCTION FUNCTIONS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
const char* print_ID( const char& ID ){
switch (ID)
{
case NUMBER: return "NUUMBERR";
case VARIABLE: return "VARIABLE";
case FUNCTION: return "FUNCTION";
case OPERATOR: return "OPERATOR";
case OPEN_FUNC: return "OPEN_FUNC";
case CLOSE_FUNC: return "CLOSE_FUNC";
case OPEN_VAR: return "OPEN_VAR";
case CLOSE_VAR: return "CLOSE_VAR";
case OPEN_PAR: return "OPEN_PAR";
case CLOSE_PAR: return "CLOSE_PAR";
case SEPARATOR: return "SEPARATOR";
default: return "UNDEFINED";
}
}
//This function prints all the tokens of vector token
//Using IDs as words, for debugging
std::ostream& operator<<(std::ostream& out, std::vector<tokens>& vector_token){
for(int i = 0; i < vector_token.size(); i++)
out << print_ID(vector_token[i].ID) << "\t" << vector_token[i].value << "\n";
}
//Reads from keyboard and saves to an string
//ans converts it from infix to postifx notation
//It returns a vector in postfix notation
std::queue<tokens> read_formula(std::string string){
//Tokenize and parse the string
std::queue<tokens> postfix_formula = parser( lexer(string).vector );
return postfix_formula;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PARSER FUNCTION FUNCTIONS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
std::ostream& operator<<(std::ostream& output, std::queue<tokens> vector_token){
while(!vector_token.empty()){
output << print_ID(vector_token.front().ID) << "\t" << vector_token.front().value << "\n";
vector_token.pop();
}
return output;
}
//Check precedence in functions and operators
int precedence(const tokens token){
if(token.value == "*" || token.value == "/")
return 3;
else if(token.value == "+" || token.value == "-")
return 2;
else if(token.value == "pow")//Here all binary functions
return 1;
else//Here all unary functions
return 0;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<EVALUATE FUNCTION FUNCTIONS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*
//Implemented moodle functions
float bin2dec(std::string number)
{
int result = 0, pow = 1;
for ( int i = number.length() - 1; i >= 0; --i, pow <<= 1 )
result += (number[i] - '0') * pow;
return (float)result;
}*/
//Instantiate variables randomly
float instantiate(int lower, int upper){
srand(time(NULL));
return (float)(rand()%(1+upper-lower))+lower;
}
//Convert string to float
float string_to_float(std::string string){
return ::atof(string.c_str());
}
//Binary operation
float compute( std::string operation, float a, float b ){
//Decide which operation
if(operation == "pow") return pow(a, b);
else if(operation == "+") return a+b;
else if(operation == "-") return a-b;
else if(operation == "*") return a*b;
else if(operation == "/") return a/b;
else if(operation == "fmod") return fmod(a,b);
else if(operation == "round") return round(a/b)*b;//Moodle round
else if(operation == "atan2") return atan2(a,b);
}
//Unary operation
float compute( std::string operation, float a ){
//Decide which operation
//Decide which operation
if(operation == "abs") return abs(a);
else if(operation == "acos") return acos(a);
else if(operation == "acosh") return acosh(a);
else if(operation == "asin") return asin(a);
else if(operation == "asinh") return asinh(a);
else if(operation == "atan") return atan(a);
else if(operation == "atanh") return atanh(a);
// else if(operation == "bindec") return bin2dec(a);//Note tested yet
else if(operation == "ceil") return ceil(a);
else if(operation == "cos") return cos(a);
else if(operation == "cosh") return cosh(a);
// else if(operation == "decbin") return decbin(a);
// else if(operation == "decoct") return decoct(a);
// else if(operation == "deg2rad") return deg2rad(a);
else if(operation == "exp") return exp(a);
else if(operation == "expm1") return exp(a)-1;
else if(operation == "floor") return floor(a);
// else if(operation == "is_finite") return is_finit(a);//Encuentra si es que un valor es un número finito legal
// else if(operation == "is_infinite") return is_infinit(a);//Encuentra si es que un valor es infinito
// else if(operation == "is_nan") return is_nan(a);//Encuentra si es que un valor no es un número
else if(operation == "log10") return log10(a);
else if(operation == "log1p") return log(1+a);
else if(operation == "log") return log(a);
// else if(operation == "max") return max(a);
// else if(operation == "min") return min(a);
// else if(operation == "octdec") return octdec(a);
// else if(operation == "rad2deg") return rad2deg(a);
else if(operation == "sin") return sin(a);
else if(operation == "sinh") return sinh(a);
else if(operation == "sqrt") return sqrt(a);
else if(operation == "tan") return tan(a);
else if(operation == "tanh") return tanh(a);
}
//No operands operation
float compute( std::string operation ){
//Decide which operation
if(operation == "rand") return (float)rand();
else if(operation == "pi") return E_PI;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER PART 1>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Lexical analyzer, lexer or tokenizer function
//It scans a string and divides it into tokens
std::vector <tokens> lexer_part_1(std::string string){
std::vector <tokens> tokenized_string;
tokens current_token;
std::string buffer;
std::string char_to_string;
std::stack<tokens> parenthesis_stack;
string = '(' + string;
char_to_string += '(';
tokenized_string.push_back({OPEN_PAR, char_to_string});
char_to_string.clear();
for(int i = 1; i < string.size(); i++){
//We are reading an sepecial character
if( is_a_separator(string[i]) ){
tokenized_string.push_back(select_special_character(string[i]));
continue;
}
//We are reading an operator simply store it
else if( is_an_operator(string[i]) ){
char_to_string += string[i];
current_token = {OPERATOR, char_to_string};
tokenized_string.push_back(current_token);
char_to_string.clear();
continue;
}
//We are reading a number
//It could be part of a real number or variable
//Ej. number = 20549; var = {myvar1}
else if(is_a_number(string[i])){
char_to_string += '{';
current_token = {OPEN_VAR, char_to_string};
//We are in a variable
if(tokenized_string.back() == current_token){
buffer += string[i];//Fill bufer until we find the end of the variable
if(string[i+1] == '}'){//We are close to exit the variable
current_token = {VARIABLE, buffer};
tokenized_string.push_back(current_token);
char_to_string.clear();
buffer.clear();
}
}
//This else is that we are reading a real number
else{
buffer+= string[i];
//This if is that we are finishing reading the real number, so lets store it
if( is_an_operator(string[i+1]) || is_a_separator(string[i+1]) || (string[i+1] == ')') || ((i+1) == string.size()) ){
current_token = {NUMBER, buffer};
tokenized_string.push_back(current_token);
buffer.clear();
}
}
char_to_string.clear();
continue;
}
if(is_a_parenthesis(string[i])){
if(string[i] == '('){
if(tokenized_string.back().ID == FUNCTION){//We found a function parenthesis
char_to_string += string[i];
current_token = {OPEN_FUNC, char_to_string};
tokenized_string.push_back(current_token);
parenthesis_stack.push(current_token);
char_to_string.clear();
}
else{//We found an asocciative parenthesis
char_to_string += string[i];
current_token = {OPEN_PAR, char_to_string};
tokenized_string.push_back(current_token);
parenthesis_stack.push(current_token);
char_to_string.clear();
}
}
else if(string[i] == ')'){
if(parenthesis_stack.top().ID == OPEN_PAR){
char_to_string += string[i];
current_token = {CLOSE_PAR, char_to_string};
tokenized_string.push_back(current_token);
char_to_string.clear();
parenthesis_stack.pop();
}
else if(parenthesis_stack.top().ID == OPEN_FUNC){
char_to_string += string[i];
current_token = {CLOSE_FUNC, char_to_string};
tokenized_string.push_back(current_token);
char_to_string.clear();
parenthesis_stack.pop();
}
}
continue;
}
//If nothing of the above, then we are reading a letter
//This menas a function or a variable
else{
buffer += string[i];
if(string[i+1] == '('){//We are terminating reading a function
current_token = {FUNCTION, buffer};
tokenized_string.push_back(current_token);
buffer.clear();
}
else if(string[i+1] == '}'){//We are terminating reading a variable
current_token = {VARIABLE, buffer};
tokenized_string.push_back(current_token);
buffer.clear();
}
}
}
tokenized_string.erase(tokenized_string.begin());
return tokenized_string;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER PART 2>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Second iteration over string
//Returns 1 if there is not an error
int lexer_part_2(std::vector <tokens>& string){
int var_flag = 0;
int open_parenthesis = 0, closing_parenthesis = 0;
int open_func = 0, closing_func = 0;
for(int i = 0; i < string.size(); i++){
//Check variables syntax correctness and eliminate brackets
if( string[i].ID == OPEN_VAR){
string.erase(string.begin()+i);
var_flag = 2;
--i;
continue;
}
else if( var_flag == 2 ){
if( string[i].ID == VARIABLE )
var_flag --;
else
return MISSING_BRACKET;
}
else if( var_flag == 1 ){
if( string[i].ID == CLOSE_VAR ){
string.erase(string.begin()+i);
var_flag--;
--i;
continue;
}
else
return MISSING_VARIABLE;
}
//Check operators correctness
else if(string[i].ID == OPERATOR){
if( (string[i-1].ID == FUNCTION) || (string[i-1].ID == OPERATOR) || (string[i+1].ID == OPERATOR)
|| (string[i-1].ID == SEPARATOR) || (string[i+1].ID == SEPARATOR) ){
return SYNTAXERROR;
}
continue;
}
//Check function and non function parenthesis correctness
else if(string[i].ID == OPEN_PAR)
open_parenthesis++;
else if(string[i].ID == CLOSE_PAR)
closing_parenthesis++;
else if(string[i].ID == OPEN_FUNC)
open_func++;
else if(string[i].ID == CLOSE_FUNC)
closing_func++;
else if( string[i].ID == CLOSE_VAR && var_flag != 1 )
return MISSING_BRACKET;
}
if(open_parenthesis != closing_parenthesis)//Not matching parenthesis number
return MISSING_PARENTHESIS;
else if (open_func != closing_func)//Not matching function parenthesis
return MISSING_FUNCTION;
else
return NOERROR;//We ended the looping without errors
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER PART 3>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Third interation over string, now to convert functions to operators
//Also evaluates the correctness of the functions
//And converts function notation to infix and parenthesis notations
int lexer_part_3(std::vector <tokens>& string){
int comma_flag = 0;
std::stack<tokens> func_stack;//Store functions to then replace commas by funcs (convert them to infix notation)
for(int i = 0; i < string.size(); i++){
//Treat unary functions
if(string[i].ID == FUNCTION && is_binary_function(string[i]) == false ){
if(string[i+1].ID == OPEN_FUNC){
string[i+1] = string[i];
string[i] = { OPEN_FUNC, "("};
i++;
continue;
}
else
return MISSING_FUNCTION;
}
//Treat binary functions
else if( string[i].ID == FUNCTION && is_binary_function(string[i]) && string[i+1].ID == OPEN_FUNC ) {
func_stack.push(string[i]);
string.erase(string.begin()+i);
comma_flag++;
--i;
continue;
}
//Treat commas
else if( string[i].ID == SEPARATOR ){
string[i] = func_stack.top();
func_stack.pop();
comma_flag--;
continue;
}
}
//If all commas were not fullfiled then there is an error
if(comma_flag != 0)
return MISSING_FUNCTION;
else
return NOERROR;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<LEXER FUNCTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Tokenizer
vector_error lexer(std::string string){
//Uncomment for debugging
int error;
std::vector<tokens> tokenized_string;
//Delete whitespaces
string.erase(remove_if(string.begin(), string.end(), isspace), string.end());
tokenized_string = lexer_part_1(string);
// std::cout << "String Tokenization\t " << string << "\t tokenized to: \n";
// print_tokens(tokenized_string);
error = lexer_part_2(tokenized_string);
// std::cout << "String Tokenization\t " << string << "\t tokenized to: \n";
// print_tokens(tokenized_string);
if( error != NOERROR )
return {tokenized_string, error};
error = lexer_part_3(tokenized_string);
/*
if( error != NOERROR )
return {tokenized_string, error};
*/
//Convert values from std::string to char
return {tokenized_string, error};
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PARSER FUNCTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Converts a tokens vector into postfix or RPN notation
//Using in the Shunting Yard Algorithm
//Returns a tokens vector
std::queue <tokens> parser(std::vector <tokens> string){
std::stack <tokens> operations;
std::queue <tokens> queue;
while(!string.empty()){//Iterate over tokens vector
//There is a operand, push it to the queue and delete on the string
if( string[0].ID == VARIABLE || string[0].ID == NUMBER )
queue.push(string[0]);
//Opening parenthesis goes to the operations stack
else if( string[0].ID == OPEN_PAR || string[0].ID == OPEN_FUNC )
operations.push(string[0]);
//If there is a closing parenthesis, pop operations to the queue till an openning one.
else if( string[0].ID == CLOSE_PAR || string[0].ID == CLOSE_FUNC ){
while ( !(operations.top().ID == OPEN_PAR || operations.top().ID == OPEN_FUNC) ){
queue.push(operations.top());
operations.pop();
}
operations.pop();//Pop the opening parenthesis
}
//This is the interesting part
else if( string[0].ID == FUNCTION || string[0].ID == OPERATOR ){
if(operations.empty())
operations.push(string[0]);
else if(operations.top().ID == OPEN_PAR || operations.top().ID == OPEN_FUNC )
operations.push(string[0]);
//Same precedence pop from stack to the queue and pop from vector to the stack
//Lower precedence pop from stack to the queue and pop from vector to the stack
else if( ( precedence(string[0]) == precedence(operations.top()) ) ||
( precedence(string[0]) < precedence(operations.top()) ) ){
queue.push(operations.top());
operations.pop();
operations.push(string[0]);
}
//Higher precedence, just push from vector to the stack
else if( precedence(string[0]) > precedence(operations.top()) ){
operations.push(string[0]);
}
}
string.erase(string.begin());
}
//If there are still operations on the stach just push them into the queue till emptying the stack
while(!operations.empty()){
queue.push(operations.top());
operations.pop();
}
return queue;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<EVALUATE FUNCTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Converts a queue of tokens in postfix notation into a result, instantiating variables
//It is an implementation of algorithm to evaluate postfix notation
float evaluate(std::queue<tokens> string, float lower, float upper){
std::stack<float> result;
float a, b;
while(!string.empty()){
//If it is a numebr convert it to float
if( string.front().ID == NUMBER)
result.push(string_to_float(string.front().value));
//If it is a variable instantiate it randomly
else if (string.front().ID == VARIABLE)
result.push(instantiate(lower, upper));
//If it is a function or operator which reciebes 2 operands compute it and store into the stack
else if( string.front().ID == OPERATOR || is_binary_function(string.front()) ){
b = result.top();
result.pop();
a = result.top();
result.pop();
result.push(compute(string.front().value, a, b));
}
//It is an unary function
else if( (string.front().ID == FUNCTION && !is_binary_function(string.front())) || string.front().value == "_"){
a = result.top();
result.pop();
result.push( compute(string.front().value, a) );
}
//It is a no operands function
else
result.push( compute(string.front().value) );
string.pop();
}
return result.top();
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<MAIN FUNCTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//Usage example
/*
int main(){
// std::string string = "pow(pow(2,2), 0)";
// std::string string = "pow(pow(4,cos({var})),cos(cos({x})))";
std::string string = "cos(2*sqrt(3)+14)";
vector_error tokenized_string;//Save tokenized string with error
std::queue<tokens> RPN;//Reverse Polish Notation
float result;
tokenized_string = lexer(string);
if(tokenized_string.error != NOERROR)
return_error(tokenized_string.error);
else{
//Print tokenized string
std::cout << "String Tokenization\t " << string << "\t tokenized to: \n"
<< tokenized_string.vector;
RPN = parser(tokenized_string.vector);
//Print parsed string
std::cout << "String Parsing\t " << string << "\t to: \n"
<< RPN;
//Evaluate the string
result = evaluate(RPN, 40, 90);
std::cout << "Result is: " << result << std::endl;
}
}
*/ | [
"1930526@upv.edu.mx"
] | 1930526@upv.edu.mx |
8913c29c4ca3a14e1b2a917bc6d916e6a2051388 | 8b191d8eb25af95c679f14b09a32f72764ae2bba | /백준/11722-가장 긴 감소하는 부분수열.cpp | b64a8702e2a06b632d74f1d67476000124026e74 | [] | no_license | cocobisc/PS | 08cd56b57ba95f4384ecbcaec3682263eeb6730f | 11ca5540632715a3c56eaee389a1946bf935ea0e | refs/heads/master | 2020-12-15T20:43:49.231103 | 2020-11-08T10:09:20 | 2020-11-08T10:09:20 | 235,249,407 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 365 | cpp | #include <bits/stdc++.h>
using namespace std;
int n, arr[1000];
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> arr[i];
vector<int> v;
reverse(arr, arr + n);
for(int i=0;i<n;i++) {
int idx = lower_bound(v.begin(), v.end(), arr[i]) - v.begin();
if(idx == v.size()) v.push_back(arr[i]);
else v[idx] = arr[i];
}
cout << v.size();
return 0;
}
| [
"xmfhs99@gmail.com"
] | xmfhs99@gmail.com |
5e6428bc4665089ade01d6184bc02efde020cbbd | 9390daeb67b447edb709de60762b3cc836370118 | /Tesseract.framework/Versions/A/Headers/bbgrid.h | 7639a0de1b1b5f08c887a549e314ad2ca5dc9f9e | [
"MIT"
] | permissive | JamesFator/OCR-Wand | 2d32eb0a3d0027206344b5f2ffb59c47066e71a4 | e5905f7cb7447b7bfa5c5b8d79a3998558a6a36c | refs/heads/master | 2020-03-10T10:24:50.882042 | 2018-04-13T02:17:17 | 2018-04-13T02:17:17 | 129,332,359 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 30,188 | h | ///////////////////////////////////////////////////////////////////////
// File: bbgrid.h
// Description: Class to hold BLOBNBOXs in a grid for fast access
// to neighbours.
// Author: Ray Smith
// Created: Wed Jun 06 17:22:01 PDT 2007
//
// (C) Copyright 2007, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////
#ifndef TESSERACT_TEXTORD_BBGRID_H__
#define TESSERACT_TEXTORD_BBGRID_H__
#include "clst.h"
#include "coutln.h"
#include "rect.h"
#include "scrollview.h"
// Some code is dependent upon leptonica. If you don't have it,
// you don't get this functionality.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifdef HAVE_LIBLEPT
#include <Leptonica/allheaders.h>
#endif
class BLOCK;
namespace tesseract {
#ifdef HAVE_LIBLEPT
// Helper function to return a scaled Pix with one pixel per grid cell,
// set (black) where the given outline enters the corresponding grid cell,
// and clear where the outline does not touch the grid cell.
// Also returns the grid coords of the bottom-left of the Pix, in *left
// and *bottom, which corresponds to (0, 0) on the Pix.
// Note that the Pix is used upside-down, with (0, 0) being the bottom-left.
Pix* TraceOutlineOnReducedPix(C_OUTLINE* outline, int gridsize,
ICOORD bleft, int* left, int* bottom);
// As TraceOutlineOnReducedPix above, but on a BLOCK instead of a C_OUTLINE.
Pix* TraceBlockOnReducedPix(BLOCK* block, int gridsize,
ICOORD bleft, int* left, int* bottom);
#endif
template<class BBC, class BBC_CLIST, class BBC_C_IT> class GridSearch;
// The BBGrid class holds C_LISTs of template classes BBC (bounding box class)
// in a grid for fast neighbour access.
// The BBC class must have a member const TBOX& bounding_box() const.
// The BBC class must have been CLISTIZEH'ed elsewhere to make the
// list class BBC_CLIST and the iterator BBC_C_IT.
// Use of C_LISTs enables BBCs to exist in multiple cells simultaneously.
// As a consequence, ownership of BBCs is assumed to be elsewhere and
// persistent for at least the life of the BBGrid, or at least until Clear is
// called which removes all references to inserted objects without actually
// deleting them.
// Most uses derive a class from a specific instantiation of BBGrid,
// thereby making most of the ugly template notation go away.
// The friend class GridSearch, with the same template arguments, is
// used to search a grid efficiently in one of several search patterns.
template<class BBC, class BBC_CLIST, class BBC_C_IT> class BBGrid {
friend class GridSearch<BBC, BBC_CLIST, BBC_C_IT>;
public:
BBGrid();
BBGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright);
virtual ~BBGrid();
// (Re)Initialize the grid. The gridsize is the size in pixels of each cell,
// and bleft, tright are the bounding box of everything to go in it.
void Init(int gridsize, const ICOORD& bleft, const ICOORD& tright);
// Empty all the lists but leave the grid itself intact.
void Clear();
// Deallocate the data in the lists but otherwise leave the lists and the grid
// intact.
void ClearGridData(void (*free_method)(BBC*));
// Simple accessors.
int gridsize() const {
return gridsize_;
}
int gridwidth() const {
return gridwidth_;
}
int gridheight() const {
return gridheight_;
}
ICOORD bleft() const {
return bleft_;
}
ICOORD tright() const {
return tright_;
}
// Insert a bbox into the appropriate place in the grid.
// If h_spread, then all cells covered horizontally by the box are
// used, otherwise, just the bottom-left. Similarly for v_spread.
// WARNING: InsertBBox may invalidate an active GridSearch. Call
// RepositionIterator() on any GridSearches that are active on this grid.
void InsertBBox(bool h_spread, bool v_spread, BBC* bbox);
#ifdef HAVE_LIBLEPT
// Using a pix from TraceOutlineOnReducedPix or TraceBlockOnReducedPix, in
// which each pixel corresponds to a grid cell, insert a bbox into every
// place in the grid where the corresponding pixel is 1. The Pix is handled
// upside-down to match the Tesseract coordinate system. (As created by
// TraceOutlineOnReducedPix or TraceBlockOnReducedPix.)
// (0, 0) in the pix corresponds to (left, bottom) in the
// grid (in grid coords), and the pix works up the grid from there.
// WARNING: InsertPixPtBBox may invalidate an active GridSearch. Call
// RepositionIterator() on any GridSearches that are active on this grid.
void InsertPixPtBBox(int left, int bottom, Pix* pix, BBC* bbox);
#endif
// Remove the bbox from the grid.
// WARNING: Any GridSearch operating on this grid could be invalidated!
// If a GridSearch is operating, call GridSearch::RemoveBBox() instead.
void RemoveBBox(BBC* bbox);
// Compute the given grid coordinates from image coords.
void GridCoords(int x, int y, int* grid_x, int* grid_y);
// Clip the given grid coordinates to fit within the grid.
void ClipGridCoords(int* x, int* y);
// Make a window of an appropriate size to display things in the grid.
ScrollView* MakeWindow(int x, int y, const char* window_name);
// Display the bounding boxes of the BLOBNBOXes in this grid.
// Use of this function requires an additional member of the BBC class:
// ScrollView::Color BBC::BoxColor() const.
void DisplayBoxes(ScrollView* window);
// ASSERT_HOST that every cell contains no more than one copy of each entry.
void AssertNoDuplicates();
// Handle a click event in a display window.
virtual void HandleClick(int x, int y);
protected:
int gridsize_; // Pixel size of each grid cell.
int gridwidth_; // Size of the grid in cells.
int gridheight_;
int gridbuckets_; // Total cells in grid.
ICOORD bleft_; // Pixel coords of bottom-left of grid.
ICOORD tright_; // Pixel coords of top-right of grid.
BBC_CLIST* grid_; // 2-d array of CLISTS of BBC elements.
private:
};
// The GridSearch class enables neighbourhood searching on a BBGrid.
template<class BBC, class BBC_CLIST, class BBC_C_IT> class GridSearch {
public:
GridSearch(BBGrid<BBC, BBC_CLIST, BBC_C_IT>* grid)
: grid_(grid), previous_return_(NULL), next_return_(NULL) {
}
// Get the grid x, y coords of the most recently returned BBC.
int GridX() const {
return x_;
}
int GridY() const {
return y_;
}
// Apart from full search, all other searches return a box several
// times if the box is inserted with h_spread or v_spread.
// This method will return true for only one occurrance of each box
// that was inserted with both h_spread and v_spread as true.
// It will usually return false for boxes that were not inserted with
// both h_spread=true and v_spread=true
bool ReturnedSeedElement() const {
TBOX box = previous_return_->bounding_box();
int x_center = (box.left()+box.right())/2;
int y_center = (box.top()+box.bottom())/2;
int grid_x, grid_y;
grid_->GridCoords(x_center, y_center, &grid_x, &grid_y);
return (x_ == grid_x) && (y_ == grid_y);
}
// Various searching iterations... Note that these iterations
// all share data members, so you can't run more than one iteration
// in parallel in a single GridSearch instance, but multiple instances
// can search the same BBGrid in parallel.
// Note that all the searches can return blobs that may not exactly
// match the search conditions, since they return everything in the
// covered grid cells. It is up to the caller to check for
// appropriateness.
// Start a new full search. Will iterate all stored blobs, from the top.
// If the blobs have been inserted using InsertBBox, (not InsertPixPtBBox)
// then the full search guarantees to return each blob in the grid once.
// Other searches may return a blob more than once if they have been
// inserted using h_spread or v_spread.
void StartFullSearch();
// Return the next bbox in the search or NULL if done.
BBC* NextFullSearch();
// Start a new radius search. Will search in a spiral upto a
// given maximum radius in grid cells from the given center in pixels.
void StartRadSearch(int x, int y, int max_radius);
// Return the next bbox in the radius search or NULL if the
// maximum radius has been reached.
BBC* NextRadSearch();
// Start a new left or right-looking search. Will search to the side
// for a box that vertically overlaps the given vertical line segment.
// CAVEAT: This search returns all blobs from the cells to the side
// of the start, and somewhat below, since there is no guarantee
// that there may not be a taller object in a lower cell. The
// blobs returned will include all those that vertically overlap and
// are no more than twice as high, but may also include some that do
// not overlap and some that are more than twice as high.
void StartSideSearch(int x, int ymin, int ymax);
// Return the next bbox in the side search or NULL if the
// edge has been reached. Searches left to right or right to left
// according to the flag.
BBC* NextSideSearch(bool right_to_left);
// Start a vertical-looking search. Will search up or down
// for a box that horizontally overlaps the given line segment.
void StartVerticalSearch(int xmin, int xmax, int y);
// Return the next bbox in the vertical search or NULL if the
// edge has been reached. Searches top to bottom or bottom to top
// according to the flag.
BBC* NextVerticalSearch(bool top_to_bottom);
// Start a rectangular search. Will search for a box that overlaps the
// given rectangle.
void StartRectSearch(const TBOX& rect);
// Return the next bbox in the rectangular search or NULL if complete.
BBC* NextRectSearch();
// Remove the last returned BBC. Will not invalidate this. May invalidate
// any other concurrent GridSearch on the same grid. If any others are
// in use, call RepositionIterator on those, to continue without harm.
void RemoveBBox();
void RepositionIterator();
private:
// Factored out helper to start a search.
void CommonStart(int x, int y);
// Factored out helper to complete a next search.
BBC* CommonNext();
// Factored out final return when search is exhausted.
BBC* CommonEnd();
// Factored out function to set the iterator to the current x_, y_
// grid coords and mark the cycle pt.
void SetIterator();
private:
// The grid we are searching.
BBGrid<BBC, BBC_CLIST, BBC_C_IT>* grid_;
// For executing a search. The different search algorithms use these in
// different ways, but most use x_origin_ and y_origin_ as the start position.
int x_origin_;
int y_origin_;
int max_radius_;
int radius_;
int rad_index_;
int rad_dir_;
TBOX rect_;
int x_; // The current location in grid coords, of the current search.
int y_;
BBC* previous_return_; // Previous return from Next*.
BBC* next_return_; // Current value of it_.data() used for repositioning.
// An iterator over the list at (x_, y_) in the grid_.
BBC_C_IT it_;
};
// Sort function to sort a BBC by bounding_box().left().
template<class BBC>
int SortByBoxLeft(const void* void1, const void* void2) {
// The void*s are actually doubly indirected, so get rid of one level.
const BBC* p1 = *reinterpret_cast<const BBC* const *>(void1);
const BBC* p2 = *reinterpret_cast<const BBC* const *>(void2);
return p1->bounding_box().left() - p2->bounding_box().left();
}
///////////////////////////////////////////////////////////////////////
// BBGrid IMPLEMENTATION.
///////////////////////////////////////////////////////////////////////
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBGrid<BBC, BBC_CLIST, BBC_C_IT>::BBGrid() : grid_(NULL) {
}
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBGrid<BBC, BBC_CLIST, BBC_C_IT>::BBGrid(
int gridsize, const ICOORD& bleft, const ICOORD& tright)
: grid_(NULL) {
Init(gridsize, bleft, tright);
}
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBGrid<BBC, BBC_CLIST, BBC_C_IT>::~BBGrid() {
if (grid_ != NULL)
delete [] grid_;
}
// (Re)Initialize the grid. The gridsize is the size in pixels of each cell,
// and bleft, tright are the bounding box of everything to go in it.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::Init(int gridsize,
const ICOORD& bleft,
const ICOORD& tright) {
gridsize_ = gridsize;
bleft_ = bleft;
tright_ = tright;
if (grid_ != NULL)
delete [] grid_;
if (gridsize_ == 0)
gridsize_ = 1;
gridwidth_ = (tright.x() - bleft.x() + gridsize_ - 1) / gridsize_;
gridheight_ = (tright.y() - bleft.y() + gridsize_ - 1) / gridsize_;
gridbuckets_ = gridwidth_ * gridheight_;
grid_ = new BBC_CLIST[gridbuckets_];
}
// Clear all lists, but leave the array of lists present.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::Clear() {
for (int i = 0; i < gridbuckets_; ++i) {
grid_[i].shallow_clear();
}
}
// Deallocate the data in the lists but otherwise leave the lists and the grid
// intact.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::ClearGridData(
void (*free_method)(BBC*)) {
if (grid_ == NULL) return;
GridSearch<BBC, BBC_CLIST, BBC_C_IT> search(this);
search.StartFullSearch();
BBC* bb;
BBC_CLIST bb_list;
BBC_C_IT it(&bb_list);
while ((bb = search.NextFullSearch()) != NULL) {
it.add_after_then_move(bb);
}
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
free_method(it.data());
}
}
// Insert a bbox into the appropriate place in the grid.
// If h_spread, then all cells covered horizontally by the box are
// used, otherwise, just the bottom-left. Similarly for v_spread.
// WARNING: InsertBBox may invalidate an active GridSearch. Call
// RepositionIterator() on any GridSearches that are active on this grid.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::InsertBBox(bool h_spread, bool v_spread,
BBC* bbox) {
TBOX box = bbox->bounding_box();
int start_x, start_y, end_x, end_y;
GridCoords(box.left(), box.bottom(), &start_x, &start_y);
GridCoords(box.right(), box.top(), &end_x, &end_y);
if (!h_spread)
end_x = start_x;
if (!v_spread)
end_y = start_y;
int grid_index = start_y * gridwidth_;
for (int y = start_y; y <= end_y; ++y, grid_index += gridwidth_) {
for (int x = start_x; x <= end_x; ++x) {
grid_[grid_index + x].add_sorted(SortByBoxLeft<BBC>, true, bbox);
}
}
}
#ifdef HAVE_LIBLEPT
// Using a pix from TraceOutlineOnReducedPix or TraceBlockOnReducedPix, in
// which each pixel corresponds to a grid cell, insert a bbox into every
// place in the grid where the corresponding pixel is 1. The Pix is handled
// upside-down to match the Tesseract coordinate system. (As created by
// TraceOutlineOnReducedPix or TraceBlockOnReducedPix.)
// (0, 0) in the pix corresponds to (left, bottom) in the
// grid (in grid coords), and the pix works up the grid from there.
// WARNING: InsertPixPtBBox may invalidate an active GridSearch. Call
// RepositionIterator() on any GridSearches that are active on this grid.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::InsertPixPtBBox(int left, int bottom,
Pix* pix, BBC* bbox) {
int width = pixGetWidth(pix);
int height = pixGetHeight(pix);
for (int y = 0; y < height; ++y) {
l_uint32* data = pixGetData(pix) + y * pixGetWpl(pix);
for (int x = 0; x < width; ++x) {
if (GET_DATA_BIT(data, x)) {
grid_[(bottom + y) * gridwidth_ + x + left].
add_sorted(SortByBoxLeft<BBC>, true, bbox);
}
}
}
}
#endif
// Remove the bbox from the grid.
// WARNING: Any GridSearch operating on this grid could be invalidated!
// If a GridSearch is operating, call GridSearch::RemoveBBox() instead.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::RemoveBBox(BBC* bbox) {
TBOX box = bbox->bounding_box();
int start_x, start_y, end_x, end_y;
GridCoords(box.left(), box.bottom(), &start_x, &start_y);
GridCoords(box.right(), box.top(), &end_x, &end_y);
int grid_index = start_y * gridwidth_;
for (int y = start_y; y <= end_y; ++y, grid_index += gridwidth_) {
for (int x = start_x; x <= end_x; ++x) {
BBC_C_IT it(&grid_[grid_index + x]);
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
if (it.data() == bbox)
it.extract();
}
}
}
}
// Compute the given grid coordinates from image coords.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::GridCoords(int x, int y,
int* grid_x, int* grid_y) {
*grid_x = (x - bleft_.x()) / gridsize_;
*grid_y = (y - bleft_.y()) / gridsize_;
ClipGridCoords(grid_x, grid_y);
}
// Clip the given grid coordinates to fit within the grid.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::ClipGridCoords(int* x, int* y) {
if (*x < 0) *x = 0;
if (*x >= gridwidth_) *x = gridwidth_ - 1;
if (*y < 0) *y = 0;
if (*y >= gridheight_) *y = gridheight_ - 1;
}
template<class G> class TabEventHandler : public SVEventHandler {
public:
explicit TabEventHandler(G* grid) : grid_(grid) {
}
void Notify(const SVEvent* sv_event) {
if (sv_event->type == SVET_CLICK) {
grid_->HandleClick(sv_event->x, sv_event->y);
}
}
private:
G* grid_;
};
// Make a window of an appropriate size to display things in the grid.
// Position the window at the given x,y.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
ScrollView* BBGrid<BBC, BBC_CLIST, BBC_C_IT>::MakeWindow(
int x, int y, const char* window_name) {
ScrollView* tab_win = NULL;
#ifndef GRAPHICS_DISABLED
tab_win = new ScrollView(window_name, x, y,
tright_.x() - bleft_.x(),
tright_.y() - bleft_.y(),
tright_.x() - bleft_.x(),
tright_.y() - bleft_.y(),
true);
TabEventHandler<BBGrid<BBC, BBC_CLIST, BBC_C_IT> >* handler =
new TabEventHandler<BBGrid<BBC, BBC_CLIST, BBC_C_IT> >(this);
tab_win->AddEventHandler(handler);
tab_win->Pen(ScrollView::GREY);
tab_win->Rectangle(0, 0, tright_.x(), tright_.y());
#endif
return tab_win;
}
// Create a window at (x,y) and display the bounding boxes of the
// BLOBNBOXes in this grid.
// Use of this function requires an additional member of the BBC class:
// ScrollView::Color BBC::BoxColor() const.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::DisplayBoxes(ScrollView* tab_win) {
#ifndef GRAPHICS_DISABLED
tab_win->Pen(ScrollView::BLUE);
tab_win->Brush(ScrollView::NONE);
// For every bbox in the grid, display it.
GridSearch<BBC, BBC_CLIST, BBC_C_IT> gsearch(this);
gsearch.StartFullSearch();
BBC* bbox;
while ((bbox = gsearch.NextFullSearch()) != NULL) {
TBOX box = bbox->bounding_box();
int left_x = box.left();
int right_x = box.right();
int top_y = box.top();
int bottom_y = box.bottom();
ScrollView::Color box_color = bbox->BoxColor();
tab_win->Pen(box_color);
tab_win->Rectangle(left_x, bottom_y, right_x, top_y);
}
tab_win->Update();
#endif
}
// ASSERT_HOST that every cell contains no more than one copy of each entry.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::AssertNoDuplicates() {
// Process all grid cells.
for (int i = gridwidth_ * gridheight_ - 1; i >= 0; --i) {
// Iterate over all elements excent the last.
for (BBC_C_IT it(&grid_[i]); !it.at_last(); it.forward()) {
BBC* ptr = it.data();
BBC_C_IT it2(it);
// None of the rest of the elements in the list should equal ptr.
for (it2.forward(); !it2.at_first(); it2.forward()) {
ASSERT_HOST(it2.data() != ptr);
}
}
}
}
// Handle a click event in a display window.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void BBGrid<BBC, BBC_CLIST, BBC_C_IT>::HandleClick(int x, int y) {
tprintf("Click at (%d, %d)\n", x, y);
}
///////////////////////////////////////////////////////////////////////
// GridSearch IMPLEMENTATION.
///////////////////////////////////////////////////////////////////////
// Start a new full search. Will iterate all stored blobs.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::StartFullSearch() {
// Full search uses x_ and y_ as the current grid
// cell being searched.
CommonStart(grid_->bleft_.x(), grid_->tright_.y());
}
// Return the next bbox in the search or NULL if done.
// The other searches will return a box that overlaps the grid cell
// thereby duplicating boxes, but NextFullSearch only returns each box once.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::NextFullSearch() {
int x;
int y;
do {
while (it_.cycled_list()) {
++x_;
if (x_ >= grid_->gridwidth_) {
--y_;
if (y_ < 0)
return CommonEnd();
x_ = 0;
}
SetIterator();
}
CommonNext();
TBOX box = previous_return_->bounding_box();
grid_->GridCoords(box.left(), box.bottom(), &x, &y);
} while (x != x_ || y != y_);
return previous_return_;
}
// Start a new radius search.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::StartRadSearch(int x, int y,
int max_radius) {
// Rad search uses x_origin_ and y_origin_ as the center of the circle.
// The radius_ is the radius of the (diamond-shaped) circle and
// rad_index/rad_dir_ combine to determine the position around it.
max_radius_ = max_radius;
radius_ = 0;
rad_index_ = 0;
rad_dir_ = 3;
CommonStart(x, y);
}
// Return the next bbox in the radius search or NULL if the
// maximum radius has been reached.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::NextRadSearch() {
while (it_.cycled_list()) {
++rad_index_;
if (rad_index_ >= radius_) {
++rad_dir_;
rad_index_ = 0;
if (rad_dir_ >= 4) {
++radius_;
if (radius_ > max_radius_)
return CommonEnd();
rad_dir_ = 0;
}
}
ICOORD offset = C_OUTLINE::chain_step(rad_dir_);
offset *= radius_ - rad_index_;
offset += C_OUTLINE::chain_step(rad_dir_ + 1) * rad_index_;
x_ = x_origin_ + offset.x();
y_ = y_origin_ + offset.y();
if (x_ >= 0 && x_ < grid_->gridwidth_ &&
y_ >= 0 && y_ < grid_->gridheight_)
SetIterator();
}
return CommonNext();
}
// Start a new left or right-looking search. Will search to the side
// for a box that vertically overlaps the given vertical line segment.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::StartSideSearch(int x,
int ymin, int ymax) {
// Right search records the x in x_origin_, the ymax in y_origin_
// and the size of the vertical strip to search in radius_.
// To guarantee finding overlapping objects of upto twice the
// given size, double the height.
radius_ = ((ymax - ymin) * 2 + grid_->gridsize_ - 1) / grid_->gridsize_;
rad_index_ = 0;
CommonStart(x, ymax);
}
// Return the next bbox in the side search or NULL if the
// edge has been reached. Searches left to right or right to left
// according to the flag.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::NextSideSearch(bool right_to_left) {
while (it_.cycled_list()) {
++rad_index_;
if (rad_index_ > radius_) {
if (right_to_left)
--x_;
else
++x_;
rad_index_ = 0;
if (x_ < 0 || x_ >= grid_->gridwidth_)
return CommonEnd();
}
y_ = y_origin_ - rad_index_;
if (y_ >= 0 && y_ < grid_->gridheight_)
SetIterator();
}
return CommonNext();
}
// Start a vertical-looking search. Will search up or down
// for a box that horizontally overlaps the given line segment.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::StartVerticalSearch(int xmin,
int xmax,
int y) {
// Right search records the xmin in x_origin_, the y in y_origin_
// and the size of the horizontal strip to search in radius_.
radius_ = (xmax - xmin + grid_->gridsize_ - 1) / grid_->gridsize_;
rad_index_ = 0;
CommonStart(xmin, y);
}
// Return the next bbox in the vertical search or NULL if the
// edge has been reached. Searches top to bottom or bottom to top
// according to the flag.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::NextVerticalSearch(
bool top_to_bottom) {
while (it_.cycled_list()) {
++rad_index_;
if (rad_index_ > radius_) {
if (top_to_bottom)
--y_;
else
++y_;
rad_index_ = 0;
if (y_ < 0 || y_ >= grid_->gridheight_)
return CommonEnd();
}
x_ = x_origin_ + rad_index_;
if (x_ >= 0 && x_ < grid_->gridwidth_)
SetIterator();
}
return CommonNext();
}
// Start a rectangular search. Will search for a box that overlaps the
// given rectangle.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::StartRectSearch(const TBOX& rect) {
// Rect search records the xmin in x_origin_, the ymin in y_origin_
// and the xmax in max_radius_.
// The search proceeds left to right, top to bottom.
rect_ = rect;
CommonStart(rect.left(), rect.top());
grid_->GridCoords(rect.right(), rect.bottom(), // - rect.height(),
&max_radius_, &y_origin_);
}
// Return the next bbox in the rectangular search or NULL if complete.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::NextRectSearch() {
while (it_.cycled_list()) {
++x_;
if (x_ > max_radius_) {
--y_;
x_ = x_origin_;
if (y_ < y_origin_)
return CommonEnd();
}
SetIterator();
}
return CommonNext();
}
// Remove the last returned BBC. Will not invalidate this. May invalidate
// any other concurrent GridSearch on the same grid. If any others are
// in use, call RepositionIterator on those, to continue without harm.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::RemoveBBox() {
if (previous_return_ != NULL) {
// Remove all instances of previous_return_ from the list, so the iterator
// remains valid after removal from the rest of the grid cells.
// if previous_return_ is not on the list, then it has been removed already.
BBC* prev_data = NULL;
BBC* new_previous_return = NULL;
it_.move_to_first();
for (it_.mark_cycle_pt(); !it_.cycled_list();) {
if (it_.data() == previous_return_) {
new_previous_return = prev_data;
it_.extract();
it_.forward();
next_return_ = it_.cycled_list() ? NULL : it_.data();
} else {
prev_data = it_.data();
it_.forward();
}
}
grid_->RemoveBBox(previous_return_);
previous_return_ = new_previous_return;
RepositionIterator();
}
}
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::RepositionIterator() {
// Reset the iterator back to one past the previous return.
// If the previous_return_ is no longer in the list, then
// next_return_ serves as a backup.
it_.move_to_first();
for (it_.mark_cycle_pt(); !it_.cycled_list(); it_.forward()) {
if (it_.data() == previous_return_ ||
it_.data_relative(1) == next_return_) {
CommonNext();
return;
}
}
// We ran off the end of the list. Move to a new cell next time.
previous_return_ = NULL;
next_return_ = NULL;
}
// Factored out helper to start a search.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::CommonStart(int x, int y) {
grid_->GridCoords(x, y, &x_origin_, &y_origin_);
x_ = x_origin_;
y_ = y_origin_;
SetIterator();
previous_return_ = NULL;
next_return_ = it_.empty() ? NULL : it_.data();
}
// Factored out helper to complete a next search.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::CommonNext() {
previous_return_ = it_.data();
it_.forward();
next_return_ = it_.cycled_list() ? NULL : it_.data();
return previous_return_;
}
// Factored out final return when search is exhausted.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
BBC* GridSearch<BBC, BBC_CLIST, BBC_C_IT>::CommonEnd() {
previous_return_ = NULL;
next_return_ = NULL;
return NULL;
}
// Factored out function to set the iterator to the current x_, y_
// grid coords and mark the cycle pt.
template<class BBC, class BBC_CLIST, class BBC_C_IT>
void GridSearch<BBC, BBC_CLIST, BBC_C_IT>::SetIterator() {
it_= &(grid_->grid_[y_ * grid_->gridwidth_ + x_]);
it_.mark_cycle_pt();
}
} // namespace tesseract.
#endif // TESSERACT_TEXTORD_BBGRID_H__
| [
"jamesfator@gmail.com"
] | jamesfator@gmail.com |
523750195a6d57dd0e43d85967dad2a85014a592 | 66862c422fda8b0de8c4a6f9d24eced028805283 | /cmake-3.17.5/Source/cmProcessTools.h | 21d59c463d1424462c6fd287a2cdeebbb0c6405c | [
"BSD-3-Clause",
"MIT"
] | permissive | zhh2005757/slambook2_in_Docker | 57ed4af958b730e6f767cd202717e28144107cdb | f0e71327d196cdad3b3c10d96eacdf95240d528b | refs/heads/main | 2023-09-01T03:26:37.542232 | 2021-10-27T11:45:47 | 2021-10-27T11:45:47 | 416,666,234 | 17 | 6 | MIT | 2021-10-13T09:51:00 | 2021-10-13T09:12:15 | null | UTF-8 | C++ | false | false | 2,617 | h | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmProcessTools_h
#define cmProcessTools_h
#include "cmConfigure.h" // IWYU pragma: keep
#include <cstring>
#include <iosfwd>
#include <string>
#include "cmProcessOutput.h"
/** \class cmProcessTools
* \brief Helper classes for process output parsing
*
*/
class cmProcessTools
{
public:
using Encoding = cmProcessOutput::Encoding;
/** Abstract interface for process output parsers. */
class OutputParser
{
public:
/** Process the given output data from a tool. Processing may be
done incrementally. Returns true if the parser is interested
in any more data and false if it is done. */
bool Process(const char* data, int length)
{
return this->ProcessChunk(data, length);
}
bool Process(const char* data)
{
return this->Process(data, static_cast<int>(strlen(data)));
}
virtual ~OutputParser() = default;
protected:
/** Implement in a subclass to process a chunk of data. It should
return true only if it is interested in more data. */
virtual bool ProcessChunk(const char* data, int length) = 0;
};
/** Process output parser that extracts one line at a time. */
class LineParser : public OutputParser
{
public:
/** Construct with line separation character and choose whether to
ignore carriage returns. */
LineParser(char sep = '\n', bool ignoreCR = true);
/** Configure logging of lines as they are extracted. */
void SetLog(std::ostream* log, const char* prefix);
protected:
std::ostream* Log = nullptr;
const char* Prefix = nullptr;
std::string Line;
char Separator;
char LineEnd = '\0';
bool IgnoreCR;
bool ProcessChunk(const char* data, int length) override;
/** Implement in a subclass to process one line of input. It
should return true only if it is interested in more data. */
virtual bool ProcessLine() = 0;
};
/** Trivial line handler for simple logging. */
class OutputLogger : public LineParser
{
public:
OutputLogger(std::ostream& log, const char* prefix = nullptr)
{
this->SetLog(&log, prefix);
}
private:
bool ProcessLine() override { return true; }
};
/** Run a process and send output to given parsers. */
static void RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
OutputParser* err = nullptr,
Encoding encoding = cmProcessOutput::Auto);
};
#endif
| [
"594353397@qq.com"
] | 594353397@qq.com |
4ee60efec02f1086a37c5084bd7fc17e96b34c56 | c34c2ca7ff4c3c77f712109c69aa926595cb00ad | /ChessProject/loadsave.cpp | d7bfbc1bb2881e5a4bb80410eca473eed02dfe1a | [] | no_license | FOSS-Pulchowk/Chess960 | 093ce194f795f7100d890f64ec63da0abf2cb1d0 | 16c21dcff4b33bae8506e4539c60644992592d5f | refs/heads/master | 2020-04-28T15:11:03.382909 | 2019-03-08T03:59:38 | 2019-03-08T03:59:38 | 175,363,824 | 2 | 1 | null | 2019-03-13T06:54:53 | 2019-03-13T06:54:53 | null | UTF-8 | C++ | false | false | 1,880 | cpp | #include "piece.h"
#include "chess.h"
#include "board.h"
#include<fstream>
void Chess::check()
{
string color, piece;
string file_name;
cout << "Type file name to be saved(no extension):";
getline(cin, filename);
file_name += ".dat";
std:: ofstream ofs(file_name);
if (ofs.is_open())
{
// Write the date and time of save operation
auto time_now = std::chron
o::system_clock::now();
std::time_t end_time = std::chrono::system_clock::to_time_t(time_now);
ofs << "[Chess console] Saved at: " << std::ctime(&end_time);
// Write the moves
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
if ((*currentBoard)[i][j].currentPiece->getColor())
{
color = "white";
piece = (*currentBoard)[i][j].currentPiece->myName();
if (myName() == "Rook") {ofs<<"wR"<<i<<j<<endl; }
if (myName() == "King") {ofs<<"wK"<<i<<j<<endl; }
if (myName() == "Pawn") {ofs<<"wP"<<i<<j<<endl; }
if (myName() == "Knight") {ofs<<"wG"<<i<<j<<endl; }
if (myName() == "Queen") {ofs<<"wQ"<<i<<j<<endl; }
if (myName() == "Bishop") {ofs<<"wB"<<i<<j<<endl; }
}
else
{
color = "black";
piece = (*currentBoard)[i][j].currentPiece->myName();
if (myName() == "Rook") {ofs<<"bR"<<i<<j<<endl; }
if (myName() == "King") {ofs<<"bK"<<i<<j<<endl; }
if (myName() == "Pawn") {ofs<<"bP"<<i<<j<<endl; }
if (myName() == "Knight") {ofs<<"bG"<<i<<j<<endl; }
if (myName() == "Queen") {ofs<<"bQ"<<i<<j<<endl; }
if (myName() == "Bishop") {ofs<<"bB"<<i<<j<<endl; }
}
}
}
createNextMessage("Game saved as " + file_name + "\n");
else
{
cout << "Error creating file! Save failed\n";
}
ofs.close();
return;
}
| [
"devakabhattarai327@gmail.com"
] | devakabhattarai327@gmail.com |
1e1e5aa688817fb817595beb06fa670c8c9219d1 | 6b50e35b60a7972ff3c3ac60a1d928b43591901c | /SignalProcessing/LDA_Truong_Tung/jni/openvibe/include/openvibe/kernel/player/ovIMessageWithData.h | 8531101adc7d116e05eec7a966a20447f8659883 | [] | no_license | damvanhuong/eeglab411 | 4a384fe06a3f5a9767c4dc222d9946640b168875 | 0aca0e64cd8e90dcde7dd021078fa14b2d61f0c9 | refs/heads/master | 2020-12-28T20:19:50.682128 | 2015-05-06T10:36:07 | 2015-05-06T10:36:07 | 35,154,165 | 1 | 0 | null | 2015-05-06T10:48:11 | 2015-05-06T10:48:10 | null | UTF-8 | C++ | false | false | 7,599 | h | #ifndef __OpenViBE_Kernel_Player_IMessageWithData_H__
#define __OpenViBE_Kernel_Player_IMessageWithData_H__
#include "../ovIKernelObject.h"
namespace OpenViBE
{
namespace Kernel
{
/**
* \class IMessageWithData
* \author Loic Mahe (Inria)
* \date 2013-10-02
* \brief A type of message that can contain different kinds of arbitrary data
* \ingroup Group_Player
* \ingroup Group_Kernel
*
* A message that can contain different kinds of data. The intended usage is for the message to be exchanged between boxes.
* A message can hold four types of data: uint64, float64, CString and IMatrix.
* Each data item is accessed by its string identifier key using a getter/setter corresponding to the data type.
* The key is unique within the data type.
*
* Although the IMessageWithData inherits IMessage, the parent class' identifier and timestamp fields are not automatically filled.
* For example, we are not timestamping the message on its creation. This is because the IMessageWithData is a type that
* was designed to be immediately processed anyway during the same kernel scheduler tick. So for most use-cases,
* the time stamp does not make sense. If needed (for example for debug purposes), the caller who fills the message
* can also stamp it or set it an identifier using the setters inherited from the parent class.
*
*/
class OV_API IMessageWithData : public OpenViBE::Kernel::IMessage
{
public:
//@}
/** \name Getters */
//@{
// Note that any returned pointers from the getters are invalid after processMessage() scope has passed.
/**
* \brief Gets the integer value stored under this key
* \param key : a reference to the name of the key
* \param rValueOut : the associated data. Unmodified in case of error.
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool getValueUint64(const CString &key, OpenViBE::uint64& rValueOut) const=0;
/**
* \brief Gets the float value stored under this key
* \param key : a reference to the name of the key
* \param rValueOut : the associated data. Unmodified in case of error.
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool getValueFloat64(const CString &key, OpenViBE::float64& rValueOut) const=0;
/**
* \brief Gets a pointer to the CString value stored under this key
* \note User should copy the content, the returned pointer will be invalid later.
* \param key : a reference to the name of the key
* \param pValueOut : pointer to the associated data. NULL in case of error. Do not free.
* \return \e true if fetched ok, false otherwise
*/
virtual bool getValueCString(const CString &key, const OpenViBE::CString** pValueOut) const=0;
/**
* \brief Gets a pointer to the CMatrix value stored under this key
* \note User should copy the content, the returned pointer will be invalid later.
* \param key : a reference to the name of the key
* \param pValueOut : pointer to the associated data. NULL in case of error. Do not free.
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool getValueIMatrix(const CString &key, const OpenViBE::IMatrix** pOutMatrix) const=0;
//@}
/** \name Setters */
//@{
/**
* \brief Sets the message internal UInt64 value stored under this key
* \param key : the name of the key
* \param valueIn : the value to put into the message
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool setValueUint64(const CString &key, uint64 valueIn)=0;
/**
* \brief Sets the message internal Float64 value stored under this key
* \param key : the name of the key
* \param valueIn : the value to put in the message
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool setValueFloat64(const CString &key, float64 valueIn)=0;
/**
* \brief Sets the message internal CString value stored under this key
* \note The message will make an internal full copy of valueIn.
* \param key : the name of the key
* \param valueIn : the value to put in the message
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool setValueCString(const CString &key, const CString &valueIn)=0;
/**
* \brief Sets the message internal IMatrix value stored under this key
* \note The message will make an internal full copy of valueIn.
* \param key : the name of the key
* \param valueIn : the data to put in the message
* \return \e true in case of success
* \return \e false in case of error
*/
virtual bool setValueIMatrix(const CString &key, const IMatrix &valueIn)=0;
//@}
/** \name Getters and iterators for keys */
//@{
/**
* \brief Get the first key of the CString container
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or container is empty
*/
virtual const OpenViBE::CString* getFirstCStringToken() const=0;
/**
* \brief Get the first key of the UInt64 container
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or container is empty
*/
virtual const OpenViBE::CString* getFirstUInt64Token() const=0;
/**
* \brief Get the first key of the Float64 container
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or container is empty
*/
virtual const OpenViBE::CString* getFirstFloat64Token() const=0;
/**
* \brief Get the first key of the CMatrix container
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or container is empty
*/
virtual const OpenViBE::CString* getFirstIMatrixToken() const=0;
/**
* \brief Get the next key of the CString container
* \param previousToken : a reference to the previous key
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or if no more tokens are available
*/
virtual const OpenViBE::CString* getNextCStringToken(const OpenViBE::CString &previousToken) const=0;
/**
* \brief Get the next key of the UInt64 container
* \param previousToken : a reference to the previous key
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or if no more tokens are available
*/
virtual const OpenViBE::CString* getNextUInt64Token(const OpenViBE::CString &previousToken) const=0;
/**
* \brief Get the next key of the Float64 container
* \param previousToken : a reference to the previous key
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or if no more tokens are available
*/
virtual const OpenViBE::CString* getNextFloat64Token(const OpenViBE::CString &previousToken) const=0;
/**
* \brief Get the next key of the CMatrix container
* \param previousToken : a reference to the previous key
* \return \e a pointer to the key in case of success
* \return \e NULL in case of error or if no more tokens are available
*/
virtual const OpenViBE::CString* getNextIMatrixToken(const OpenViBE::CString &previousToken) const=0;
//@}
//_IsDerivedFromClass_(OpenViBE::Kernel::IMessage, OV_ClassId_Kernel_Player_MessageWithData)
};
};
};
#endif // __OpenViBE_Kernel_Player_IMessageWithData_H__
| [
"nguyenhaitruonghp@gmail.com"
] | nguyenhaitruonghp@gmail.com |
63811f2fdbc48d2d34b0f46e0d7fed6fd27d0c85 | 32983d47a0715deec9da6651910961582b68e459 | /Semester1/Laba4/Variant10/Variant10.cpp | 2a98b2c3b4988e542c920bccd3b171fc12384edd | [] | no_license | afrochonsp/OAiP | 8729dc6b3350e889d05b3a9c33aea5f56e606374 | 7d967c605c0916349b8f2ddffe9a6d4082c41af9 | refs/heads/main | 2023-07-15T10:15:11.078463 | 2021-08-20T23:15:05 | 2021-08-20T23:15:05 | 398,412,278 | 0 | 0 | null | 2021-08-20T22:59:18 | 2021-08-20T22:18:44 | null | UTF-8 | C++ | false | false | 1,516 | cpp | #include <iostream>
#include <cmath>
using namespace std;
int Factorial(int);
float Y(float, float);
float S(float, float);
float DistanceYS(float, float);
void Out_Rez(float(*function)(float, float), float, float, float, float);
int main()
{
system("chcp 1251");
system("cls");
Start:
float b = 1, n = 10, h = 0.1f, x = 0.1f;
char q;
cout << "Использовать стандартные занчения? (y - да, n - нет)\n";
cin >> q;
if (q != 'y')
{
cout << "Введите a\n";
cin >> x;
cout << "Введите b\n";
cin >> b;
cout << "Введите n\n";
cin >> n;
cout << "Введите h\n";
cin >> h;
}
cout << "Выберите функцию:\n1 - Y(x)\n2 - S(x)\n3 - |Y(x) - S(x)|\n";
cin >> q;
float(*function)(float, float) = q == '1' ? Y : q == '2' ? S : DistanceYS;
Out_Rez(function, x, b, h, n);
goto Start;
}
void Out_Rez(float(*f)(float, float), float x, float b, float h, float n)
{
for (int c = (int)floor(abs(b - x) / h); c >= 0; c--, x += h * (1 - 2 * (x > b)))
cout << "x = " << x << "\n" << (f == Y ? "Y(x)" : f == S ? "S(x)" : "|Y(x) - S(x)|") << " = " << f(x, n) << "\n";
cout << "\n";
}
int Factorial(int n)
{
int f = 1;
for (int i = 1; i <= n; i++) f *= i;
return f;
}
float Y(float x, float n)
{
return (exp(x) + exp(-x)) / 2;
}
float S(float x, float n)
{
float s = 0;
for (int k = 0; k <= n; k++) s += pow(x, 2 * k) / Factorial(2 * k);
return s;
}
float DistanceYS(float x, float n)
{
return abs(Y(x, n) - S(x, n));
}
| [
"afrochonsp@gmail.com"
] | afrochonsp@gmail.com |
a6719c22e21fb5d71317e234b1267493f84d1ca8 | b3710dfdd0eeb3e28d3a4c666af5df6558a03553 | /cgodeps/godot_engine/servers/navigation_server_3d.h | c34bd2391b49d4ca5b352fce0826624b55e63578 | [
"MIT",
"LicenseRef-scancode-free-unknown",
"CC-BY-3.0",
"OFL-1.1",
"BSD-3-Clause",
"Bitstream-Vera",
"FTL",
"MPL-2.0",
"Zlib",
"LicenseRef-scancode-nvidia-2002",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"CC-BY-4.0"
] | permissive | gabstv/godot-go | 5befd7539ef35a9e459046644dd4b246a0db1ad9 | e0e7f07e1e44716e18330f063c9b3fd3c2468d31 | refs/heads/master | 2021-05-21T23:48:25.434825 | 2020-08-27T16:52:18 | 2020-08-27T16:52:18 | 252,864,512 | 10 | 3 | MIT | 2020-08-27T16:52:20 | 2020-04-03T23:26:52 | C++ | UTF-8 | C++ | false | false | 8,393 | h | /*************************************************************************/
/* navigation_server_3d.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
/**
@author AndreaCatania
*/
#ifndef NAVIGATION_SERVER_H
#define NAVIGATION_SERVER_H
#include "core/object.h"
#include "core/rid.h"
#include "scene/3d/navigation_region_3d.h"
/// This server uses the concept of internal mutability.
/// All the constant functions can be called in multithread because internally
/// the server takes care to schedule the functions access.
///
/// Note: All the `set` functions are commands executed during the `sync` phase,
/// don't expect that a change is immediately propagated.
class NavigationServer3D : public Object {
GDCLASS(NavigationServer3D, Object);
static NavigationServer3D *singleton;
protected:
static void _bind_methods();
public:
/// Thread safe, can be used across many threads.
static const NavigationServer3D *get_singleton();
/// MUST be used in single thread!
static NavigationServer3D *get_singleton_mut();
/// Create a new map.
virtual RID map_create() const = 0;
/// Set map active.
virtual void map_set_active(RID p_map, bool p_active) const = 0;
/// Returns true if the map is active.
virtual bool map_is_active(RID p_map) const = 0;
/// Set the map UP direction.
virtual void map_set_up(RID p_map, Vector3 p_up) const = 0;
/// Returns the map UP direction.
virtual Vector3 map_get_up(RID p_map) const = 0;
/// Set the map cell size used to weld the navigation mesh polygons.
virtual void map_set_cell_size(RID p_map, real_t p_cell_size) const = 0;
/// Returns the map cell size.
virtual real_t map_get_cell_size(RID p_map) const = 0;
/// Set the map edge connection margin used to weld the compatible region edges.
virtual void map_set_edge_connection_margin(RID p_map, real_t p_connection_margin) const = 0;
/// Returns the edge connection margin of this map.
virtual real_t map_get_edge_connection_margin(RID p_map) const = 0;
/// Returns the navigation path to reach the destination from the origin.
virtual Vector<Vector3> map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize) const = 0;
virtual Vector3 map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision = false) const = 0;
virtual Vector3 map_get_closest_point(RID p_map, const Vector3 &p_point) const = 0;
virtual Vector3 map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const = 0;
virtual RID map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const = 0;
/// Creates a new region.
virtual RID region_create() const = 0;
/// Set the map of this region.
virtual void region_set_map(RID p_region, RID p_map) const = 0;
/// Set the global transformation of this region.
virtual void region_set_transform(RID p_region, Transform p_transform) const = 0;
/// Set the navigation mesh of this region.
virtual void region_set_navmesh(RID p_region, Ref<NavigationMesh> p_nav_mesh) const = 0;
/// Bake the navigation mesh
virtual void region_bake_navmesh(Ref<NavigationMesh> r_mesh, Node *p_node) const = 0;
/// Creates the agent.
virtual RID agent_create() const = 0;
/// Put the agent in the map.
virtual void agent_set_map(RID p_agent, RID p_map) const = 0;
/// The maximum distance (center point to
/// center point) to other agents this agent
/// takes into account in the navigation. The
/// larger this number, the longer the running
/// time of the simulation. If the number is too
/// low, the simulation will not be safe.
/// Must be non-negative.
virtual void agent_set_neighbor_dist(RID p_agent, real_t p_dist) const = 0;
/// The maximum number of other agents this
/// agent takes into account in the navigation.
/// The larger this number, the longer the
/// running time of the simulation. If the
/// number is too low, the simulation will not
/// be safe.
virtual void agent_set_max_neighbors(RID p_agent, int p_count) const = 0;
/// The minimal amount of time for which this
/// agent's velocities that are computed by the
/// simulation are safe with respect to other
/// agents. The larger this number, the sooner
/// this agent will respond to the presence of
/// other agents, but the less freedom this
/// agent has in choosing its velocities.
/// Must be positive.
virtual void agent_set_time_horizon(RID p_agent, real_t p_time) const = 0;
/// The radius of this agent.
/// Must be non-negative.
virtual void agent_set_radius(RID p_agent, real_t p_radius) const = 0;
/// The maximum speed of this agent.
/// Must be non-negative.
virtual void agent_set_max_speed(RID p_agent, real_t p_max_speed) const = 0;
/// Current velocity of the agent
virtual void agent_set_velocity(RID p_agent, Vector3 p_velocity) const = 0;
/// The new target velocity.
virtual void agent_set_target_velocity(RID p_agent, Vector3 p_velocity) const = 0;
/// Position of the agent in world space.
virtual void agent_set_position(RID p_agent, Vector3 p_position) const = 0;
/// Agent ignore the Y axis and avoid collisions by moving only on the horizontal plane
virtual void agent_set_ignore_y(RID p_agent, bool p_ignore) const = 0;
/// Returns true if the map got changed the previous frame.
virtual bool agent_is_map_changed(RID p_agent) const = 0;
/// Callback called at the end of the RVO process
virtual void agent_set_callback(RID p_agent, Object *p_receiver, StringName p_method, Variant p_udata = Variant()) const = 0;
/// Destroy the `RID`
virtual void free(RID p_object) const = 0;
/// Control activation of this server.
virtual void set_active(bool p_active) const = 0;
/// Process the collision avoidance agents.
/// The result of this process is needed by the physics server,
/// so this must be called in the main thread.
/// Note: This function is not thread safe.
virtual void process(real_t delta_time) = 0;
NavigationServer3D();
virtual ~NavigationServer3D();
};
typedef NavigationServer3D *(*NavigationServer3DCallback)();
/// Manager used for the server singleton registration
class NavigationServer3DManager {
static NavigationServer3DCallback create_callback;
public:
static void set_default_server(NavigationServer3DCallback p_callback);
static NavigationServer3D *new_default_server();
};
#endif
| [
"gabs@gabs.tv"
] | gabs@gabs.tv |
9af2016910352356d79876c2052a1030e1e11459 | 09882ac9f3d0949cadc9743544f24a7b12f962fd | /src/stream/cookie.cpp | df472dcb2f460a24ad785df2e5cc0c5848b7adfb | [] | no_license | ousttrue/w3m1 | ddcc240c5d9017ce78dd41cca3197c6bd191f0a1 | eaf5969cdacb3f9ae19e1fa32a652c88695fbf4c | refs/heads/master | 2022-12-08T23:58:04.264222 | 2020-09-03T13:30:24 | 2020-09-03T13:30:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 28,308 | cpp | /*
* References for version 0 cookie:
* [NETACAPE] http://www.netscape.com/newsref/std/cookie_spec.html
*
* References for version 1 cookie:
* [RFC 2109] http://www.ics.uci.edu/pub/ietf/http/rfc2109.txt
* [DRAFT 12] http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-state-man-mec-12.txt
*/
#include <sstream>
#include <list>
#include <string_view_util.h>
#include "stream/cookie.h"
#include "stream/network.h"
#include "indep.h"
#include "rc.h"
#include "commands.h"
#include "mytime.h"
#include "regex.h"
#include "myctype.h"
#include "frontend/buffer.h"
#include "file.h"
#include "frontend/display.h"
#include "frontend/terminal.h"
#include "html/parsetag.h"
#include "html/html_context.h"
#include <time.h>
#ifdef INET6
#include <sys/socket.h>
#endif /* INET6 */
#ifndef __MINGW32_VERSION
#include <netdb.h>
#else
#include <winsock.h>
#endif
#define COO_USE 1
#define COO_SECURE 2
#define COO_DOMAIN 4
#define COO_PATH 8
#define COO_DISCARD 16
#define COO_OVERRIDE 32 /* user chose to override security checks */
#define COO_OVERRIDE_OK 32 /* flag to specify that an error is overridable */
/* version 0 refers to the original cookie_spec.html */
/* version 1 refers to RFC 2109 */
/* version 1' refers to the Internet draft to obsolete RFC 2109 */
#define COO_EINTERNAL (1) /* unknown error; probably forgot to convert "return 1" in cookie.c */
#define COO_ETAIL (2 | COO_OVERRIDE_OK) /* tail match failed (version 0) */
#define COO_ESPECIAL (3) /* special domain check failed (version 0) */
#define COO_EPATH (4) /* Path attribute mismatch (version 1 case 1) */
#define COO_ENODOT (5 | COO_OVERRIDE_OK) /* no embedded dots in Domain (version 1 case 2.1) */
#define COO_ENOTV1DOM (6 | COO_OVERRIDE_OK) /* Domain does not start with a dot (version 1 case 2.2) */
#define COO_EDOM (7 | COO_OVERRIDE_OK) /* domain-match failed (version 1 case 3) */
#define COO_EBADHOST (8 | COO_OVERRIDE_OK) /* dot in matched host name in FQDN (version 1 case 4) */
#define COO_EPORT (9) /* Port match failed (version 1' case 5) */
#define COO_EMAX COO_EPORT
static int
total_dot_number(const char *p, const char *ep, int max_count)
{
int count = 0;
if (!ep)
ep = p + strlen(p);
for (; p < ep && count < max_count; p++)
{
if (*p == '.')
count++;
}
return count;
}
#define contain_no_dots(p, ep) (total_dot_number((p), (ep), 1) == 0)
static std::string domain_match(const std::string &host, const std::string &domain)
{
/* [RFC 2109] s. 2, "domain-match", case 1
* (both are IP and identical)
*/
regexCompile("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+", 0);
auto m0 = regexMatch(const_cast<char *>(host.c_str()), -1, 1);
auto m1 = regexMatch(const_cast<char *>(domain.c_str()), -1, 1);
if (m0 && m1)
{
if (host == domain)
return host;
}
else if (!m0 && !m1)
{
/*
* "." match all domains (w3m only),
* and ".local" match local domains ([DRAFT 12] s. 2)
*/
if (domain == "." || domain == ".local")
{
auto offset = host.size();
auto domain_p = &host[offset];
if (domain[1] == '\0' || contain_no_dots(host.c_str(), domain_p))
return domain_p;
}
/*
* special case for domainName = .hostName
* see nsCookieService.cpp in Firefox.
*/
else if (domain[0] == '.' && host == &domain[1])
{
return host;
}
/* [RFC 2109] s. 2, cases 2, 3 */
else
{
auto offset = (domain[0] != '.') ? 0 : host.size() - domain.size();
auto domain_p = &host[offset];
if (offset >= 0 && strcasecmp(domain_p, domain.c_str()) == 0)
return domain_p;
}
}
return "";
}
static bool
port_match(const std::vector<uint16_t> &l, int port)
{
return std::find(l.begin(), l.end(), port) != l.end();
}
struct Cookie
{
URL url;
Str name = nullptr;
Str value = nullptr;
time_t expires = {};
Str path = nullptr;
Str domain = nullptr;
Str comment = nullptr;
Str commentURL = nullptr;
std::vector<uint16_t> portl;
char version = 0;
char flag = 0;
Cookie *next = nullptr;
bool Match(const URL *pu, const std::string &domainname) const
{
if (domainname.empty())
{
return false;
}
if (domain_match(domainname, this->domain->ptr).empty())
return false;
if (strncmp(this->path->ptr, pu->path.c_str(), this->path->Size()) != 0)
return false;
if (this->flag & COO_SECURE && pu->scheme != SCM_HTTPS)
return false;
if (this->portl.size() && !port_match(this->portl, pu->port))
return false;
return true;
}
Str ToStr() const
{
Str tmp = name->Clone();
tmp->Push('=');
tmp->Push(value);
return tmp;
}
};
using CookiePtr = std::shared_ptr<Cookie>;
static std::list<CookiePtr> g_cookies;
static int is_saved = 1;
static std::vector<uint16_t> make_portlist(Str port)
{
std::vector<uint16_t> l;
Str tmp = Strnew();
auto p = port->ptr;
while (*p)
{
while (*p && !IS_DIGIT(*p))
p++;
tmp->Clear();
while (*p && IS_DIGIT(*p))
tmp->Push(*(p++));
if (tmp->Size() == 0)
break;
l.push_back(atoi(tmp->ptr));
}
return l;
}
static std::string
portlist2str(const std::vector<uint16_t> &l)
{
std::stringstream ss;
auto tmp = Strnew();
for (int i = 0; i < l.size(); ++i)
{
if (i)
{
ss << ", ";
}
ss << l[i];
}
return ss.str();
}
static void check_expired_cookies(void)
{
if (g_cookies.empty())
return;
time_t now = time(NULL);
for (auto &cookie : g_cookies)
{
if (cookie->expires != (time_t)-1 && cookie->expires < now)
{
if (!(cookie->flag & COO_DISCARD))
is_saved = 0;
}
}
}
CookiePtr get_cookie_info(Str domain, Str path, Str name)
{
for (auto &cookie : g_cookies)
{
if (cookie->domain->ICaseCmp(domain) == 0 &&
cookie->path->Cmp(path) == 0 && cookie->name->ICaseCmp(name) == 0)
return cookie;
}
return NULL;
}
Str find_cookie(const URL &url)
{
auto fq_domainname = Network::Instance().FQDN(url.host);
check_expired_cookies();
CookiePtr fco;
for (auto &cookie : g_cookies)
{
auto domainname = (cookie->version == 0) ? fq_domainname : url.host;
if (cookie->flag & COO_USE && cookie->Match(&url, domainname))
{
fco = cookie;
}
}
if (!fco)
return NULL;
// Cookie *p, *p1;
auto tmp = Strnew();
int version = 0;
if (version > 0)
tmp->Push(Sprintf("$Version=\"%d\"; ", version));
tmp->Push(fco->ToStr());
// for (p1 = fco->next; p1; p1 = p1->next)
{
tmp->Push("; ");
tmp->Push(fco->ToStr());
if (version > 0)
{
// if (p1->flag & COO_PATH)
// tmp->Push(Sprintf("; $Path=\"%s\"", p1->path->ptr));
// if (p1->flag & COO_DOMAIN)
// tmp->Push(Sprintf("; $Domain=\"%s\"", p1->domain->ptr));
// if (p1->portl.size())
// tmp->Push(Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)));
}
}
return tmp;
}
CookieManager::CookieManager()
{
}
CookieManager::~CookieManager()
{
save_cookies();
}
CookieManager &CookieManager::Instance()
{
static CookieManager cm;
return cm;
}
const char *special_domain[] = {
".com", ".edu", ".gov", ".mil", ".net", ".org", ".int", NULL};
int CookieManager::check_avoid_wrong_number_of_dots_domain(Str domain)
{
// TextListItem *tl;
int avoid_wrong_number_of_dots_domain = false;
for (auto &d : this->Cookie_avoid_wrong_number_of_dots_domains)
{
if (domain_match(domain->ptr, d).size())
{
avoid_wrong_number_of_dots_domain = true;
break;
}
}
if (avoid_wrong_number_of_dots_domain == true)
{
return true;
}
else
{
return false;
}
}
int CookieManager::add_cookie(const URL &pu, Str name, Str value,
time_t expires, Str domain, Str path,
int flag, Str comment, bool version2, Str port, Str commentURL)
{
auto domainname = !version2 ? Network::Instance().FQDN(pu.host) : pu.host;
Str odomain = domain, opath = path;
std::vector<uint16_t> portlist;
int use_security = !(flag & COO_OVERRIDE);
#define COOKIE_ERROR(err) \
if (!((err)&COO_OVERRIDE_OK) || use_security) \
return (err)
#ifdef DEBUG
fprintf(stderr, "host: [%s, %s] %d\n", pu->host, pu->file, flag);
fprintf(stderr, "cookie: [%s=%s]\n", name->ptr, value->ptr);
fprintf(stderr, "expires: [%s]\n", asctime(gmtime(&expires)));
if (domain)
fprintf(stderr, "domain: [%s]\n", domain->ptr);
if (path)
fprintf(stderr, "path: [%s]\n", path->ptr);
fprintf(stderr, "version: [%d]\n", version);
if (port)
fprintf(stderr, "port: [%s]\n", port->ptr);
#endif /* DEBUG */
/* [RFC 2109] s. 4.3.2 case 2; but this (no request-host) shouldn't happen */
if (domainname.empty())
return COO_ENODOT;
if (domain)
{
/* [DRAFT 12] s. 4.2.2 (does not apply in the case that
* host name is the same as domain attribute for version 0
* cookie)
* I think that this rule has almost the same effect as the
* tail match of [NETSCAPE].
*/
if (domain->ptr[0] != '.' &&
(version2 || domainname == domain->ptr))
domain = Sprintf(".%s", domain->ptr);
if (!version2)
{
/* [NETSCAPE] rule */
int n = total_dot_number(domain->ptr,
domain->ptr + domain->Size(),
3);
if (n < 2)
{
if (!check_avoid_wrong_number_of_dots_domain(domain))
{
COOKIE_ERROR(COO_ESPECIAL);
}
}
else if (n == 2)
{
char **sdomain;
int ok = 0;
for (sdomain = (char **)special_domain; !ok && *sdomain; sdomain++)
{
int offset = domain->Size() - strlen(*sdomain);
if (offset >= 0 &&
strcasecmp(*sdomain, &domain->ptr[offset]) == 0)
ok = 1;
}
if (!ok && !check_avoid_wrong_number_of_dots_domain(domain))
{
COOKIE_ERROR(COO_ESPECIAL);
}
}
}
else
{
/* [DRAFT 12] s. 4.3.2 case 2 */
if (strcasecmp(domain->ptr, ".local") != 0 &&
contain_no_dots(&domain->ptr[1], &domain->ptr[domain->Size()]))
COOKIE_ERROR(COO_ENODOT);
}
/* [RFC 2109] s. 4.3.2 case 3 */
auto dp = domain_match(domainname, domain->ptr);
if (!dp.empty())
COOKIE_ERROR(COO_EDOM);
/* [RFC 2409] s. 4.3.2 case 4 */
/* Invariant: dp contains matched domain */
if (version2 && !contain_no_dots(domainname.c_str(), dp.c_str()))
COOKIE_ERROR(COO_EBADHOST);
}
if (path)
{
/* [RFC 2109] s. 4.3.2 case 1 */
if (version2 && strncmp(path->ptr, pu.path.c_str(), path->Size()) != 0)
COOKIE_ERROR(COO_EPATH);
}
if (port)
{
/* [DRAFT 12] s. 4.3.2 case 5 */
portlist = make_portlist(port);
if (portlist.size() && !port_match(portlist, pu.port))
COOKIE_ERROR(COO_EPORT);
}
if (!domain)
domain = Strnew(domainname);
if (!path)
{
path = Strnew(pu.path);
while (path->Size() > 0 && path->Back() != '/')
path->Pop(1);
if (path->Back() == '/')
path->Pop(1);
}
auto p = get_cookie_info(domain, path, name);
if (!p)
{
g_cookies.push_back({});
p = g_cookies.back();
p->flag = 0;
if (this->default_use_cookie)
p->flag |= COO_USE;
// p->next = First_cookie;
// First_cookie = p;
}
p->url = pu;
p->name = name;
p->value = value;
p->expires = expires;
p->domain = domain;
p->path = path;
p->comment = comment;
p->version = version2 ? 2 : 1;
p->portl = portlist;
p->commentURL = commentURL;
if (flag & COO_SECURE)
p->flag |= COO_SECURE;
else
p->flag &= ~COO_SECURE;
if (odomain)
p->flag |= COO_DOMAIN;
else
p->flag &= ~COO_DOMAIN;
if (opath)
p->flag |= COO_PATH;
else
p->flag &= ~COO_PATH;
if (flag & COO_DISCARD || p->expires == (time_t)-1)
{
p->flag |= COO_DISCARD;
}
else
{
p->flag &= ~COO_DISCARD;
is_saved = 0;
}
check_expired_cookies();
return 0;
}
static CookiePtr nth_cookie(int n)
{
int i;
for (auto &cookie : g_cookies)
{
if (i++ == n)
return cookie;
}
return NULL;
}
#define str2charp(str) ((str) ? (str)->ptr : "")
void CookieManager::save_cookies()
{
if (g_cookies.empty() || is_saved || w3mApp::Instance().no_rc_dir)
return;
check_expired_cookies();
auto cookie_file = rcFile(COOKIE_FILE);
FILE *fp;
if (!(fp = fopen(cookie_file, "w")))
return;
for (auto &cookie : g_cookies)
{
if (!(cookie->flag & COO_USE) || cookie->flag & COO_DISCARD)
continue;
fprintf(fp, "%s\t%s\t%s\t%ld\t%s\t%s\t%d\t%d\t%s\t%s\t%s\n",
cookie->url.ToStr()->ptr,
cookie->name->ptr, cookie->value->ptr, cookie->expires,
cookie->domain->ptr, cookie->path->ptr, cookie->flag,
cookie->version, str2charp(cookie->comment),
portlist2str(cookie->portl).c_str(),
str2charp(cookie->commentURL));
}
fclose(fp);
chmod(cookie_file, S_IRUSR | S_IWUSR);
}
static Str
readcol(char **p)
{
Str tmp = Strnew();
while (**p && **p != '\n' && **p != '\r' && **p != '\t')
tmp->Push(*((*p)++));
if (**p == '\t')
(*p)++;
return tmp;
}
void load_cookies(void)
{
FILE *fp;
if (!(fp = fopen(rcFile(COOKIE_FILE), "r")))
return;
for (;;)
{
auto line = Strfgets(fp);
if (line->Size() == 0)
break;
auto str = line->ptr;
auto cookie = std::make_shared<Cookie>();
g_cookies.push_back(cookie);
cookie->flag = 0;
cookie->version = 0;
cookie->expires = (time_t)-1;
cookie->comment = NULL;
cookie->commentURL = NULL;
cookie->url = URL::Parse(readcol(&str)->ptr, nullptr);
if (!*str)
return;
cookie->name = readcol(&str);
if (!*str)
return;
cookie->value = readcol(&str);
if (!*str)
return;
cookie->expires = (time_t)atol(readcol(&str)->ptr);
if (!*str)
return;
cookie->domain = readcol(&str);
if (!*str)
return;
cookie->path = readcol(&str);
if (!*str)
return;
cookie->flag = atoi(readcol(&str)->ptr);
if (!*str)
return;
cookie->version = atoi(readcol(&str)->ptr);
if (!*str)
return;
cookie->comment = readcol(&str);
if (cookie->comment->Size() == 0)
cookie->comment = NULL;
if (!*str)
return;
cookie->portl = make_portlist(readcol(&str));
if (!*str)
return;
cookie->commentURL = readcol(&str);
if (cookie->commentURL->Size() == 0)
cookie->commentURL = NULL;
}
fclose(fp);
}
void initCookie(void)
{
load_cookies();
check_expired_cookies();
}
BufferPtr CookieManager::cookie_list_panel()
{
if (!use_cookie || g_cookies.empty())
return NULL;
/* FIXME: gettextize? */
Str src = Strnew("<html><head><title>Cookies</title></head>"
"<body><center><b>Cookies</b></center>"
"<p><form method=internal action=cookie>");
int i;
char *tmp, tmp2[80];
src->Push("<ol>");
for (auto &p : g_cookies)
{
tmp = html_quote(p->url.ToStr()->ptr);
if (p->expires != (time_t)-1)
{
#ifdef HAVE_STRFTIME
strftime(tmp2, 80, "%a, %d %b %Y %H:%M:%S GMT",
gmtime(&p->expires));
#else /* not HAVE_STRFTIME */
struct tm *gmt;
static char *dow[] = {
"Sun ", "Mon ", "Tue ", "Wed ", "Thu ", "Fri ", "Sat "};
static char *month[] = {
"Jan ", "Feb ", "Mar ", "Apr ", "May ", "Jun ",
"Jul ", "Aug ", "Sep ", "Oct ", "Nov ", "Dec "};
gmt = gmtime(&p->expires);
strcpy(tmp2, dow[gmt->tm_wday]);
sprintf(&tmp2[4], "%02d ", gmt->tm_mday);
strcpy(&tmp2[7], month[gmt->tm_mon]);
if (gmt->tm_year < 1900)
sprintf(&tmp2[11], "%04d %02d:%02d:%02d GMT",
(gmt->tm_year) + 1900, gmt->tm_hour, gmt->tm_min,
gmt->tm_sec);
else
sprintf(&tmp2[11], "%04d %02d:%02d:%02d GMT",
gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
#endif /* not HAVE_STRFTIME */
}
else
tmp2[0] = '\0';
src->Push("<li>");
src->Push("<h1><a href=\"");
src->Push(tmp);
src->Push("\">");
src->Push(tmp);
src->Push("</a></h1>");
src->Push("<table cellpadding=0>");
if (!(p->flag & COO_SECURE))
{
src->Push("<tr><td width=\"80\"><b>Cookie:</b></td><td>");
src->Push(html_quote(p->ToStr()));
src->Push("</td></tr>");
}
if (p->comment)
{
src->Push("<tr><td width=\"80\"><b>Comment:</b></td><td>");
src->Push(html_quote(p->comment->ptr));
src->Push("</td></tr>");
}
if (p->commentURL)
{
src->Push("<tr><td width=\"80\"><b>CommentURL:</b></td><td>");
src->Push("<a href=\"");
src->Push(html_quote(p->commentURL->ptr));
src->Push("\">");
src->Push(html_quote(p->commentURL->ptr));
src->Push("</a>");
src->Push("</td></tr>");
}
if (tmp2[0])
{
src->Push("<tr><td width=\"80\"><b>Expires:</b></td><td>");
src->Push(tmp2);
if (p->flag & COO_DISCARD)
src->Push(" (Discard)");
src->Push("</td></tr>");
}
src->Push("<tr><td width=\"80\"><b>Version:</b></td><td>");
src->Push(Sprintf("%d", p->version)->ptr);
src->Push("</td></tr><tr><td>");
if (p->domain)
{
src->Push("<tr><td width=\"80\"><b>Domain:</b></td><td>");
src->Push(html_quote(p->domain->ptr));
src->Push("</td></tr>");
}
if (p->path)
{
src->Push("<tr><td width=\"80\"><b>Path:</b></td><td>");
src->Push(html_quote(p->path->ptr));
src->Push("</td></tr>");
}
if (p->portl.size())
{
src->Push("<tr><td width=\"80\"><b>Port:</b></td><td>");
src->Push(html_quote(portlist2str(p->portl)));
src->Push("</td></tr>");
}
src->Push("<tr><td width=\"80\"><b>Secure:</b></td><td>");
src->Push((p->flag & COO_SECURE) ? (char *)"Yes" : (char *)"No");
src->Push("</td></tr><tr><td>");
src->Push(Sprintf("<tr><td width=\"80\"><b>Use:</b></td><td>"
"<input type=radio name=\"%d\" value=1%s>Yes"
" "
"<input type=radio name=\"%d\" value=0%s>No",
i, (p->flag & COO_USE) ? " checked" : "",
i, (!(p->flag & COO_USE)) ? " checked" : ""));
src->Push("</td></tr><tr><td><input type=submit value=\"OK\"></table><p>");
}
src->Push("</ol></form></body></html>");
return loadHTMLStream(URL::Parse("w3m://cookie"), StrStream::Create(src->ptr), WC_CES_UTF_8, true);
}
void set_cookie_flag(tcb::span<parsed_tagarg> _arg)
{
for (auto &arg : _arg)
{
auto n = atoi(arg.arg);
auto v = atoi(arg.value);
if (auto p = nth_cookie(n))
{
if (v && !(p->flag & COO_USE))
p->flag |= COO_USE;
else if (!v && p->flag & COO_USE)
p->flag &= ~COO_USE;
if (!(p->flag & COO_DISCARD))
is_saved = 0;
}
}
backBf(&w3mApp::Instance(), {});
}
bool CookieManager::check_cookie_accept_domain(const std::string &domain)
{
if (domain.empty())
{
return false;
}
for (auto &d : this->Cookie_accept_domains)
{
if (domain_match(domain, d).size())
{
return true;
}
}
for (auto &d : this->Cookie_reject_domains)
{
if (domain_match(domain, d).size())
{
return false;
}
}
return true;
}
/* This array should be somewhere else */
/* FIXME: gettextize? */
const char *violations[COO_EMAX] = {
"internal error",
"tail match failed",
"wrong number of dots",
"RFC 2109 4.3.2 rule 1",
"RFC 2109 4.3.2 rule 2.1",
"RFC 2109 4.3.2 rule 2.2",
"RFC 2109 4.3.2 rule 3",
"RFC 2109 4.3.2 rule 4",
"RFC XXXX 4.3.2 rule 5"};
void CookieManager::ProcessHttpHeader(const URL &url, bool version2, std::string_view line)
{
if (!use_cookie)
{
return;
}
if (!accept_cookie)
{
return;
}
if (!check_cookie_accept_domain(url.host))
{
return;
}
auto p = line.data();
auto name = Strnew();
while (*p != '=' && !IS_ENDT(*p))
name->Push(*(p++));
StripRight(name);
auto value = Strnew();
if (*p == '=')
{
p++;
SKIP_BLANKS(&p);
int quoted = 0;
const char *q = nullptr;
while (!IS_ENDL(*p) && (quoted || *p != ';'))
{
if (!IS_SPACE(*p))
q = p;
if (*p == '"')
quoted = (quoted) ? 0 : 1;
value->Push(*(p++));
}
if (q)
value->Pop(p - q - 1);
}
Str domain = NULL;
Str path = NULL;
int flag = 0;
Str comment = NULL;
Str commentURL = NULL;
Str port = NULL;
time_t expires = (time_t)-1;
while (*p == ';')
{
p++;
SKIP_BLANKS(&p);
Str tmp2;
if (matchattr(p, "expires", 7, &tmp2))
{
/* version 0 */
expires = mymktime(tmp2->ptr);
}
else if (matchattr(p, "max-age", 7, &tmp2))
{
/* XXX Is there any problem with max-age=0? (RFC 2109 ss. 4.2.1, 4.2.2 */
expires = time(NULL) + atol(tmp2->ptr);
}
else if (matchattr(p, "domain", 6, &tmp2))
{
domain = tmp2;
}
else if (matchattr(p, "path", 4, &tmp2))
{
path = tmp2;
}
else if (matchattr(p, "secure", 6, NULL))
{
flag |= COO_SECURE;
}
else if (matchattr(p, "comment", 7, &tmp2))
{
comment = tmp2;
}
else if (matchattr(p, "version", 7, &tmp2))
{
assert(false);
// version = (CookieVersions)atoi(tmp2->ptr);
}
else if (matchattr(p, "port", 4, &tmp2))
{
/* version 1, Set-Cookie2 */
port = tmp2;
}
else if (matchattr(p, "commentURL", 10, &tmp2))
{
/* version 1, Set-Cookie2 */
commentURL = tmp2;
}
else if (matchattr(p, "discard", 7, NULL))
{
/* version 1, Set-Cookie2 */
flag |= COO_DISCARD;
}
int quoted = 0;
while (!IS_ENDL(*p) && (quoted || *p != ';'))
{
if (*p == '"')
quoted = (quoted) ? 0 : 1;
p++;
}
}
if (name->Size() > 0)
{
int err;
if (this->show_cookie)
{
if (flag & COO_SECURE)
disp_message_nsec("Received a secured cookie", false, 1,
true, false);
else
disp_message_nsec(Sprintf("Received cookie: %s=%s",
name->ptr, value->ptr)
->ptr,
false, 1, true, false);
}
err =
add_cookie(url, name, value, expires, domain, path, flag,
comment, version2, port, commentURL);
if (err)
{
const char *ans = (this->accept_bad_cookie == ACCEPT_BAD_COOKIE_ACCEPT)
? "y"
: NULL;
if ((err & COO_OVERRIDE_OK) &&
this->accept_bad_cookie == ACCEPT_BAD_COOKIE_ASK)
{
Str msg = Sprintf("Accept bad cookie from %s for %s?",
url.host,
((domain && domain->ptr)
? domain->ptr
: "<localdomain>"));
if (msg->Size() > ::Terminal::columns() - 10)
msg->Pop(msg->Size() - (::Terminal::columns() - 10));
msg->Push(" (y/n)");
ans = inputAnswer(msg->ptr);
}
if (ans == NULL || TOLOWER(*ans) != 'y' ||
(err =
add_cookie(url, name, value, expires, domain, path,
flag | COO_OVERRIDE, comment, version2,
port, commentURL)))
{
err = (err & ~COO_OVERRIDE_OK) - 1;
const char *emsg;
if (err >= 0 && err < COO_EMAX)
emsg = Sprintf("This cookie was rejected "
"to prevent security violation. [%s]",
violations[err])
->ptr;
else
emsg =
"This cookie was rejected to prevent security violation.";
record_err_message(emsg);
if (this->show_cookie)
disp_message_nsec(emsg, false, 1, true, false);
}
else if (this->show_cookie)
disp_message_nsec(Sprintf("Accepting invalid cookie: %s=%s",
name->ptr, value->ptr)
->ptr,
false,
1, true, false);
}
}
}
std::vector<std::string> _make_domain_list(std::string_view src)
{
auto splitter = svu::splitter(src, [](char c) -> bool {
return IS_SPACE(c) || c == ',';
});
std::vector<std::string> list;
for (auto s : splitter)
{
list.push_back(std::string(s));
}
return list;
}
void CookieManager::Initialize()
{
this->Cookie_reject_domains = _make_domain_list(this->cookie_reject_domains);
this->Cookie_accept_domains = _make_domain_list(this->cookie_accept_domains);
this->Cookie_avoid_wrong_number_of_dots_domains = _make_domain_list(this->cookie_avoid_wrong_number_of_dots);
}
| [
"ousttrue@gmail.com"
] | ousttrue@gmail.com |
8df07ac7c1e762c09d9b0636333991f9246460ec | 093d964b2b1d231c9c34dd3910ccd9e52a579b17 | /libraries/converter/src/converter/Latex2util.hpp | 92441e3bed4fac86563b21c0d00d4862f35f01f0 | [] | no_license | MarcAntoine-Arnaud/xml2epub | a550e50b6b1ae3efea9f1785c725e7bdcc30b188 | f21eb50e1560e5c261c36a4e39906f608cf74dc9 | refs/heads/master | 2021-01-13T01:50:06.175407 | 2013-04-07T11:54:41 | 2013-04-07T11:54:41 | 9,261,722 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 236 | hpp | #include <iostream>
namespace xml2epub {
void latex2pdf( std::istream& input, std::string& pdf_path );
void latex2svg( std::istream& input, std::ostream& output );
void pdf2svg( const std::string& pdf_path, std::ostream& output );
}
| [
"arnaud.marcantoine@gmail.com"
] | arnaud.marcantoine@gmail.com |
4000808cb5e49c5fb0e67b74673f3140a12d7631 | b28305dab0be0e03765c62b97bcd7f49a4f8073d | /base/android/jni_android.cc | aae65a65c132f20f28af357d26764983183c3930 | [
"BSD-3-Clause"
] | permissive | svarvel/browser-android-tabs | 9e5e27e0a6e302a12fe784ca06123e5ce090ced5 | bd198b4c7a1aca2f3e91f33005d881f42a8d0c3f | refs/heads/base-72.0.3626.105 | 2020-04-24T12:16:31.442851 | 2019-08-02T19:15:36 | 2019-08-02T19:15:36 | 171,950,555 | 1 | 2 | NOASSERTION | 2019-08-02T19:15:37 | 2019-02-21T21:47:44 | null | UTF-8 | C++ | false | false | 9,840 | cc | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/android/jni_android.h"
#include <stddef.h>
#include <sys/prctl.h>
#include <map>
#include "base/android/java_exception_reporter.h"
#include "base/android/jni_string.h"
#include "base/debug/debugging_buildflags.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/threading/thread_local.h"
namespace {
using base::android::GetClass;
using base::android::MethodID;
using base::android::ScopedJavaLocalRef;
JavaVM* g_jvm = NULL;
base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject>>::Leaky
g_class_loader = LAZY_INSTANCE_INITIALIZER;
jmethodID g_class_loader_load_class_method_id = 0;
#if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS)
base::LazyInstance<base::ThreadLocalPointer<void>>::Leaky
g_stack_frame_pointer = LAZY_INSTANCE_INITIALIZER;
#endif
bool g_fatal_exception_occurred = false;
} // namespace
namespace base {
namespace android {
JNIEnv* AttachCurrentThread() {
DCHECK(g_jvm);
JNIEnv* env = nullptr;
jint ret = g_jvm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_2);
if (ret == JNI_EDETACHED || !env) {
JavaVMAttachArgs args;
args.version = JNI_VERSION_1_2;
args.group = nullptr;
// 16 is the maximum size for thread names on Android.
char thread_name[16];
int err = prctl(PR_GET_NAME, thread_name);
if (err < 0) {
DPLOG(ERROR) << "prctl(PR_GET_NAME)";
args.name = nullptr;
} else {
args.name = thread_name;
}
ret = g_jvm->AttachCurrentThread(&env, &args);
DCHECK_EQ(JNI_OK, ret);
}
return env;
}
JNIEnv* AttachCurrentThreadWithName(const std::string& thread_name) {
DCHECK(g_jvm);
JavaVMAttachArgs args;
args.version = JNI_VERSION_1_2;
args.name = thread_name.c_str();
args.group = NULL;
JNIEnv* env = NULL;
jint ret = g_jvm->AttachCurrentThread(&env, &args);
DCHECK_EQ(JNI_OK, ret);
return env;
}
void DetachFromVM() {
// Ignore the return value, if the thread is not attached, DetachCurrentThread
// will fail. But it is ok as the native thread may never be attached.
if (g_jvm)
g_jvm->DetachCurrentThread();
}
void InitVM(JavaVM* vm) {
DCHECK(!g_jvm || g_jvm == vm);
g_jvm = vm;
}
bool IsVMInitialized() {
return g_jvm != NULL;
}
void InitReplacementClassLoader(JNIEnv* env,
const JavaRef<jobject>& class_loader) {
DCHECK(g_class_loader.Get().is_null());
DCHECK(!class_loader.is_null());
ScopedJavaLocalRef<jclass> class_loader_clazz =
GetClass(env, "java/lang/ClassLoader");
CHECK(!ClearException(env));
g_class_loader_load_class_method_id =
env->GetMethodID(class_loader_clazz.obj(),
"loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;");
CHECK(!ClearException(env));
DCHECK(env->IsInstanceOf(class_loader.obj(), class_loader_clazz.obj()));
g_class_loader.Get().Reset(class_loader);
}
ScopedJavaLocalRef<jclass> GetClass(JNIEnv* env, const char* class_name) {
jclass clazz;
if (!g_class_loader.Get().is_null()) {
// ClassLoader.loadClass expects a classname with components separated by
// dots instead of the slashes that JNIEnv::FindClass expects. The JNI
// generator generates names with slashes, so we have to replace them here.
// TODO(torne): move to an approach where we always use ClassLoader except
// for the special case of base::android::GetClassLoader(), and change the
// JNI generator to generate dot-separated names. http://crbug.com/461773
size_t bufsize = strlen(class_name) + 1;
char dotted_name[bufsize];
memmove(dotted_name, class_name, bufsize);
for (size_t i = 0; i < bufsize; ++i) {
if (dotted_name[i] == '/') {
dotted_name[i] = '.';
}
}
clazz = static_cast<jclass>(
env->CallObjectMethod(g_class_loader.Get().obj(),
g_class_loader_load_class_method_id,
ConvertUTF8ToJavaString(env, dotted_name).obj()));
} else {
clazz = env->FindClass(class_name);
}
if (ClearException(env) || !clazz) {
LOG(FATAL) << "Failed to find class " << class_name;
}
return ScopedJavaLocalRef<jclass>(env, clazz);
}
jclass LazyGetClass(
JNIEnv* env,
const char* class_name,
std::atomic<jclass>* atomic_class_id) {
const jclass value = std::atomic_load(atomic_class_id);
if (value)
return value;
ScopedJavaGlobalRef<jclass> clazz;
clazz.Reset(GetClass(env, class_name));
jclass cas_result = nullptr;
if (std::atomic_compare_exchange_strong(atomic_class_id, &cas_result,
clazz.obj())) {
// We intentionally leak the global ref since we now storing it as a raw
// pointer in |atomic_class_id|.
return clazz.Release();
} else {
return cas_result;
}
}
template<MethodID::Type type>
jmethodID MethodID::Get(JNIEnv* env,
jclass clazz,
const char* method_name,
const char* jni_signature) {
auto get_method_ptr = type == MethodID::TYPE_STATIC ?
&JNIEnv::GetStaticMethodID :
&JNIEnv::GetMethodID;
jmethodID id = (env->*get_method_ptr)(clazz, method_name, jni_signature);
if (base::android::ClearException(env) || !id) {
LOG(FATAL) << "Failed to find " <<
(type == TYPE_STATIC ? "static " : "") <<
"method " << method_name << " " << jni_signature;
}
return id;
}
// If |atomic_method_id| set, it'll return immediately. Otherwise, it'll call
// into ::Get() above. If there's a race, it's ok since the values are the same
// (and the duplicated effort will happen only once).
template<MethodID::Type type>
jmethodID MethodID::LazyGet(JNIEnv* env,
jclass clazz,
const char* method_name,
const char* jni_signature,
std::atomic<jmethodID>* atomic_method_id) {
const jmethodID value = std::atomic_load(atomic_method_id);
if (value)
return value;
jmethodID id = MethodID::Get<type>(env, clazz, method_name, jni_signature);
std::atomic_store(atomic_method_id, id);
return id;
}
// Various template instantiations.
template jmethodID MethodID::Get<MethodID::TYPE_STATIC>(
JNIEnv* env, jclass clazz, const char* method_name,
const char* jni_signature);
template jmethodID MethodID::Get<MethodID::TYPE_INSTANCE>(
JNIEnv* env, jclass clazz, const char* method_name,
const char* jni_signature);
template jmethodID MethodID::LazyGet<MethodID::TYPE_STATIC>(
JNIEnv* env, jclass clazz, const char* method_name,
const char* jni_signature, std::atomic<jmethodID>* atomic_method_id);
template jmethodID MethodID::LazyGet<MethodID::TYPE_INSTANCE>(
JNIEnv* env, jclass clazz, const char* method_name,
const char* jni_signature, std::atomic<jmethodID>* atomic_method_id);
bool HasException(JNIEnv* env) {
return env->ExceptionCheck() != JNI_FALSE;
}
bool ClearException(JNIEnv* env) {
if (!HasException(env))
return false;
env->ExceptionDescribe();
env->ExceptionClear();
return true;
}
void CheckException(JNIEnv* env) {
if (!HasException(env))
return;
jthrowable java_throwable = env->ExceptionOccurred();
if (java_throwable) {
// Clear the pending exception, since a local reference is now held.
env->ExceptionDescribe();
env->ExceptionClear();
if (g_fatal_exception_occurred) {
// Another exception (probably OOM) occurred during GetJavaExceptionInfo.
base::android::SetJavaException(
"Java OOM'ed in exception handling, check logcat");
} else {
g_fatal_exception_occurred = true;
// RVO should avoid any extra copies of the exception string.
base::android::SetJavaException(
GetJavaExceptionInfo(env, java_throwable).c_str());
}
}
// Now, feel good about it and die.
LOG(FATAL) << "Please include Java exception stack in crash report";
}
std::string GetJavaExceptionInfo(JNIEnv* env, jthrowable java_throwable) {
ScopedJavaLocalRef<jclass> log_clazz = GetClass(env, "android/util/Log");
jmethodID log_getstacktracestring = MethodID::Get<MethodID::TYPE_STATIC>(
env, log_clazz.obj(), "getStackTraceString",
"(Ljava/lang/Throwable;)Ljava/lang/String;");
// Call Log.getStackTraceString()
ScopedJavaLocalRef<jstring> exception_string(
env, static_cast<jstring>(env->CallStaticObjectMethod(
log_clazz.obj(), log_getstacktracestring, java_throwable)));
CheckException(env);
ScopedJavaLocalRef<jclass> piielider_clazz =
GetClass(env, "org/chromium/base/PiiElider");
jmethodID piielider_sanitize_stacktrace =
MethodID::Get<MethodID::TYPE_STATIC>(
env, piielider_clazz.obj(), "sanitizeStacktrace",
"(Ljava/lang/String;)Ljava/lang/String;");
ScopedJavaLocalRef<jstring> sanitized_exception_string(
env, static_cast<jstring>(env->CallStaticObjectMethod(
piielider_clazz.obj(), piielider_sanitize_stacktrace,
exception_string.obj())));
CheckException(env);
return ConvertJavaStringToUTF8(sanitized_exception_string);
}
#if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS)
JNIStackFrameSaver::JNIStackFrameSaver(void* current_fp) {
previous_fp_ = g_stack_frame_pointer.Pointer()->Get();
g_stack_frame_pointer.Pointer()->Set(current_fp);
}
JNIStackFrameSaver::~JNIStackFrameSaver() {
g_stack_frame_pointer.Pointer()->Set(previous_fp_);
}
void* JNIStackFrameSaver::SavedFrame() {
return g_stack_frame_pointer.Pointer()->Get();
}
#endif // BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS)
} // namespace android
} // namespace base
| [
"artem@brave.com"
] | artem@brave.com |
3edd8d850884dda1591c1e457daa63482b5643c7 | 8a850de5174a7019c310a8fcbfb4fd21412ca2f1 | /Logger.ino | fa0e6ee4186983cb562e329ba8f9e1cc9ef9fb32 | [] | no_license | avoronkov17/Logger | 91fbd0d0d176fafc27cf1dc6a80784389a8e6523 | 9f1408fc053acd05644b37594ff3df94dd0ade85 | refs/heads/main | 2023-03-18T22:52:25.776903 | 2021-03-09T08:52:38 | 2021-03-09T08:52:38 | 339,735,328 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,511 | ino | #include <UIPEthernet.h>
#include <avr/wdt.h>
#include "settings.h"
#include "shared_code.h"
#include "parameters.h"
#define LINK_OFF 1
#define ERR_LINK 2
#define ETHERNET_ERROR 3 /* Не удалось инициализировать Ethernet */
#define UDP_RECEIVER_ERROR 4 /* Ошибка инициализации UDP приёмника*/
#define WAIT_SEND 5000 /* Ожидание отправки дейтаграммы */
#define MSG_SIZE 1 /*Размер сообщения от сервера*/
EthernetUDP udpServ;
EthernetUDP udpClient;
int32_t g_serverNotAnswer = 0; /*сколько сервер нам не отвечает*/
uint32_t g_timeMS = 0;
bool g_mustReadReply = false;
struct st_parameters g_logger_data; /* Структура с параметрами. В ней всё хранится */
const byte mymac[] PROGMEM = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x34 };
char stringWithParams[64];
/**** местные функции ****/
int8_t init_ethernet(void);
uint8_t resetFlags __attribute__ ((section(".noinit")));
void check_watch_dog(void);
int check_udp_reply(); /* Приём квитанции от сервера */
/*************************/
/*Для работы с WatchDog*/
uint8_t resetFlagsInit (void) __attribute__ ((naked))
__attribute__ ((used))
__attribute__ ((section(".init0")));
void setup (void)
{
Serial.begin(9600);
pinMode(LED, OUTPUT);
check_watch_dog();
Parametrist_setup(&g_logger_data);
Serial.println(F("Wait ether..."));
int err = 0;
if ( (err = init_ethernet()) != 0 )
{
ERROR_RESTART(ETHERNET_ERROR, "Etherner init error");
}
Serial.println(F("Ethernet OK"));
int success = udpServ.begin(UDP_BIND_PORT);
if (success == 0)
ERROR_RESTART(UDP_RECEIVER_ERROR, "UDP bind error");
Serial.print(F("UDP Server OK"));
g_timeMS = millis();
wdt_enable(WDTO_4S);
}
void loop (void)
{
wdt_reset();
int success;
if (g_mustReadReply) // Ожидаем ответ на отправку
{
if ( check_udp_reply() > 0 )
g_serverNotAnswer = 0;
}
if (g_serverNotAnswer >= 10 )
{
Serial.println(F("Server not answer. Rebooting nano..."));
wdt_enable(WDTO_2S);
delay(4000);
}
if (millis() > g_timeMS )
{
Parametrist_update(&g_logger_data);
// Формат (параметры разделены запятой): номер_платы,eq,reg,токи,напряжения
m_add_to_string(stringWithParams, "%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
PLAT_NUM,
g_logger_data.is_eq, g_logger_data.is_reg,
g_logger_data.i_a, g_logger_data.i_b,
g_logger_data.i_c,
g_logger_data.v_a, g_logger_data.v_b,
g_logger_data.v_c);
do
{
//beginPacket fails if remote ethaddr is unknown. In this case an
//arp-request is send out first and beginPacket succeeds as soon
//the arp-response is received.
success = udpClient.beginPacket(IPAddress(SERVER_IP), PORT_DST);
}
while (!success && ((long)(millis() - WAIT_SEND ))<0);
if (!success )
goto stop;
Serial.println(F("Sending..."));
success = udpClient.write((const char*)(&g_logger_data), sizeof(g_logger_data));
//success = udp.write(stringWithParams, strlen(stringWithParams));
if (!success )
goto stop;
success = udpClient.endPacket();
if (!success)
goto stop;
success = 1;
g_mustReadReply = true;
g_serverNotAnswer++; /*Увеличиваем счётчик неподтверждённых пакетов */
stop:
if (!success)
Serial.print(F("Send failed"));
udpClient.stop();
g_timeMS = millis() + SEND_DELAY;
}
}
/*Ethernet.begin(mac,IPAddress(192,168,0,6));
* Инициализация сетевой карточки.
* Возвращает 0, в случае успешной инициализации , или код ошибки.
*/
int8_t init_ethernet(void)
{
//Ethernet.begin( mymac, IPAddress(172,31,54,254));
if (Ethernet.begin( mymac) == 0)
{
emergency(ETHERNET_ERROR, 1);
return ETHERNET_ERROR;
}
//Serial.print("IP: ");
Serial.println(IpAddress2String(Ethernet.localIP()));
//Serial.print("Mask: ");
Serial.println(IpAddress2String(Ethernet.subnetMask()));
//Serial.print("Gateway: ");
Serial.println(IpAddress2String(Ethernet.gatewayIP()));
return 0;
}
/* проверка причины перезапуска */
void check_watch_dog(void)
{
/*if (TestBit((const uint8_t* )(&resetFlags) , WDRF ))
{
Serial.println(F("WATDGDGDGDG"));
}
if (TestBit((const uint8_t* )(&resetFlags) , BORF ))
{
Serial.println(F("BOOOORF"));
}*/
if (resetFlags & (1 << WDRF))
{
resetFlags &= ~(1 << WDRF);
Serial.println(F("Watchdog"));
}
if (resetFlags & (1 << BORF))
{
resetFlags &= ~(1 << BORF);
Serial.println(F("Brownout"));
}
if (resetFlags & (1 << EXTRF))
{
resetFlags &= ~(1 << EXTRF);
Serial.println(F("External"));
}
if (resetFlags & (1 << PORF))
{
resetFlags &= ~(1 << PORF);
Serial.println(F("PowerOn"));
}
if (resetFlags != 0x00)
{
Serial.println(F("Unknown"));
}
}
/* Приём квитанции от сервера */
int check_udp_reply()
{
int size = udpServ.parsePacket();
if (size < 1)
return 0;
do
{
char msg[MSG_SIZE + 1];
int len = udpServ.read(msg, MSG_SIZE + 2);
msg[len]=0;
int8_t cmd;
memcpy((void*)(&cmd), msg, sizeof(cmd));
Serial.print("cmd:");
Serial.print(cmd);
}
while ( (size = udpServ.available()) > 0);
//Заканчиваем чтение пакета:
udpServ.flush();
/*Serial.print(F("remote ip:"));
Serial.println(udpServ.remoteIP());
Serial.print(F("remote port:"));
Serial.println(udpServ.remotePort());*/
udpServ.stop();
Serial.print(F("restart connection: "));
Serial.println (udpServ.begin(UDP_BIND_PORT) ? "OK" : "FAIL");
g_mustReadReply = false;
return 1;
}
uint8_t resetFlagsInit (void)
{
__asm__ __volatile__ ("sts %0, r2\n" : "=m" (resetFlags) :);
}
| [
"den2011chs8@gmail.com"
] | den2011chs8@gmail.com |
8ad2695383403faf6460ed1c03b1038fb0fc85c2 | ed91c77afaeb0e075da38153aa89c6ee8382d3fc | /mediasoup-client/deps/webrtc/src/pc/test/fake_audio_capture_module_unittest.cc | 63b41cddedc031881ae1e20bc93bafe8911ae963 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-google-patent-license-webrtc",
"LicenseRef-scancode-google-patent-license-webm"
] | permissive | whatisor/mediasoup-client-android | 37bf1aeaadc8db642cff449a26545bf15da27539 | dc3d812974991d9b94efbc303aa2deb358928546 | refs/heads/master | 2023-04-26T12:24:18.355241 | 2023-01-02T16:55:19 | 2023-01-02T16:55:19 | 243,833,549 | 0 | 0 | MIT | 2020-02-28T18:56:36 | 2020-02-28T18:56:36 | null | UTF-8 | C++ | false | false | 7,076 | cc | /*
* Copyright 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "pc/test/fake_audio_capture_module.h"
#include <string.h>
#include <algorithm>
#include "api/scoped_refptr.h"
#include "rtc_base/gunit.h"
#include "rtc_base/synchronization/mutex.h"
#include "test/gtest.h"
class FakeAdmTest : public ::testing::Test, public webrtc::AudioTransport {
protected:
static const int kMsInSecond = 1000;
FakeAdmTest()
: push_iterations_(0), pull_iterations_(0), rec_buffer_bytes_(0) {
memset(rec_buffer_, 0, sizeof(rec_buffer_));
}
void SetUp() override {
fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
EXPECT_TRUE(fake_audio_capture_module_.get() != NULL);
}
// Callbacks inherited from webrtc::AudioTransport.
// ADM is pushing data.
int32_t RecordedDataIsAvailable(const void* audioSamples,
const size_t nSamples,
const size_t nBytesPerSample,
const size_t nChannels,
const uint32_t samplesPerSec,
const uint32_t totalDelayMS,
const int32_t clockDrift,
const uint32_t currentMicLevel,
const bool keyPressed,
uint32_t& newMicLevel) override {
webrtc::MutexLock lock(&mutex_);
rec_buffer_bytes_ = nSamples * nBytesPerSample;
if ((rec_buffer_bytes_ == 0) ||
(rec_buffer_bytes_ >
FakeAudioCaptureModule::kNumberSamples *
FakeAudioCaptureModule::kNumberBytesPerSample)) {
ADD_FAILURE();
return -1;
}
memcpy(rec_buffer_, audioSamples, rec_buffer_bytes_);
++push_iterations_;
newMicLevel = currentMicLevel;
return 0;
}
void PullRenderData(int bits_per_sample,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
void* audio_data,
int64_t* elapsed_time_ms,
int64_t* ntp_time_ms) override {}
// ADM is pulling data.
int32_t NeedMorePlayData(const size_t nSamples,
const size_t nBytesPerSample,
const size_t nChannels,
const uint32_t samplesPerSec,
void* audioSamples,
size_t& nSamplesOut,
int64_t* elapsed_time_ms,
int64_t* ntp_time_ms) override {
webrtc::MutexLock lock(&mutex_);
++pull_iterations_;
const size_t audio_buffer_size = nSamples * nBytesPerSample;
const size_t bytes_out =
RecordedDataReceived()
? CopyFromRecBuffer(audioSamples, audio_buffer_size)
: GenerateZeroBuffer(audioSamples, audio_buffer_size);
nSamplesOut = bytes_out / nBytesPerSample;
*elapsed_time_ms = 0;
*ntp_time_ms = 0;
return 0;
}
int push_iterations() const {
webrtc::MutexLock lock(&mutex_);
return push_iterations_;
}
int pull_iterations() const {
webrtc::MutexLock lock(&mutex_);
return pull_iterations_;
}
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
private:
bool RecordedDataReceived() const { return rec_buffer_bytes_ != 0; }
size_t GenerateZeroBuffer(void* audio_buffer, size_t audio_buffer_size) {
memset(audio_buffer, 0, audio_buffer_size);
return audio_buffer_size;
}
size_t CopyFromRecBuffer(void* audio_buffer, size_t audio_buffer_size) {
EXPECT_EQ(audio_buffer_size, rec_buffer_bytes_);
const size_t min_buffer_size =
std::min(audio_buffer_size, rec_buffer_bytes_);
memcpy(audio_buffer, rec_buffer_, min_buffer_size);
return min_buffer_size;
}
mutable webrtc::Mutex mutex_;
int push_iterations_;
int pull_iterations_;
char rec_buffer_[FakeAudioCaptureModule::kNumberSamples *
FakeAudioCaptureModule::kNumberBytesPerSample];
size_t rec_buffer_bytes_;
};
TEST_F(FakeAdmTest, PlayoutTest) {
EXPECT_EQ(0, fake_audio_capture_module_->RegisterAudioCallback(this));
bool stereo_available = false;
EXPECT_EQ(0, fake_audio_capture_module_->StereoPlayoutIsAvailable(
&stereo_available));
EXPECT_TRUE(stereo_available);
EXPECT_NE(0, fake_audio_capture_module_->StartPlayout());
EXPECT_FALSE(fake_audio_capture_module_->PlayoutIsInitialized());
EXPECT_FALSE(fake_audio_capture_module_->Playing());
EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout());
EXPECT_EQ(0, fake_audio_capture_module_->InitPlayout());
EXPECT_TRUE(fake_audio_capture_module_->PlayoutIsInitialized());
EXPECT_FALSE(fake_audio_capture_module_->Playing());
EXPECT_EQ(0, fake_audio_capture_module_->StartPlayout());
EXPECT_TRUE(fake_audio_capture_module_->Playing());
uint16_t delay_ms = 10;
EXPECT_EQ(0, fake_audio_capture_module_->PlayoutDelay(&delay_ms));
EXPECT_EQ(0, delay_ms);
EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond);
EXPECT_GE(0, push_iterations());
EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout());
EXPECT_FALSE(fake_audio_capture_module_->Playing());
}
TEST_F(FakeAdmTest, RecordTest) {
EXPECT_EQ(0, fake_audio_capture_module_->RegisterAudioCallback(this));
bool stereo_available = false;
EXPECT_EQ(0, fake_audio_capture_module_->StereoRecordingIsAvailable(
&stereo_available));
EXPECT_FALSE(stereo_available);
EXPECT_NE(0, fake_audio_capture_module_->StartRecording());
EXPECT_FALSE(fake_audio_capture_module_->Recording());
EXPECT_EQ(0, fake_audio_capture_module_->StopRecording());
EXPECT_EQ(0, fake_audio_capture_module_->InitRecording());
EXPECT_EQ(0, fake_audio_capture_module_->StartRecording());
EXPECT_TRUE(fake_audio_capture_module_->Recording());
EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond);
EXPECT_GE(0, pull_iterations());
EXPECT_EQ(0, fake_audio_capture_module_->StopRecording());
EXPECT_FALSE(fake_audio_capture_module_->Recording());
}
TEST_F(FakeAdmTest, DuplexTest) {
EXPECT_EQ(0, fake_audio_capture_module_->RegisterAudioCallback(this));
EXPECT_EQ(0, fake_audio_capture_module_->InitPlayout());
EXPECT_EQ(0, fake_audio_capture_module_->StartPlayout());
EXPECT_EQ(0, fake_audio_capture_module_->InitRecording());
EXPECT_EQ(0, fake_audio_capture_module_->StartRecording());
EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond);
EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond);
EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout());
EXPECT_EQ(0, fake_audio_capture_module_->StopRecording());
}
| [
"wuhaiyang1213@gmail.com"
] | wuhaiyang1213@gmail.com |
3bd1bdf74ad5513232de74d122232bbb8dddec98 | 1b85451b46622e5e294498270131acfa8e6d8bc6 | /trunk/src/kernel/srs_kernel_ts.hpp | 06042acab3d7afa3fb6c50588652535d85074e42 | [] | no_license | shilonghai/srs-minor-bug-fix | 1af5335b35f58cfe8c8f7f9985626013e03f7e15 | 22af15d82f73d1a2a4367e123cd3394af34cb422 | refs/heads/master | 2021-01-23T22:30:29.463692 | 2017-09-09T07:28:41 | 2017-09-09T07:28:41 | 102,935,499 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 75,542 | hpp | /*
The MIT License (MIT)
Copyright (c) 2013-2015 SRS(ossrs)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_KERNEL_TS_HPP
#define SRS_KERNEL_TS_HPP
/*
#include <srs_kernel_ts.hpp>
*/
#include <srs_core.hpp>
#if !defined(SRS_EXPORT_LIBRTMP)
#include <string>
#include <map>
#include <vector>
#include <srs_kernel_codec.hpp>
class SrsStream;
class SrsTsCache;
class SrsTSMuxer;
class SrsFileWriter;
class SrsFileReader;
class SrsAvcAacCodec;
class SrsCodecSample;
class SrsSimpleBuffer;
class SrsTsAdaptationField;
class SrsTsPayload;
class SrsTsMessage;
class SrsTsPacket;
class SrsTsContext;
// Transport Stream packets are 188 bytes in length.
#define SRS_TS_PACKET_SIZE 188
// the aggregate pure audio for hls, in ts tbn(ms * 90).
#define SRS_CONSTS_HLS_PURE_AUDIO_AGGREGATE 720 * 90
/**
* the pid of ts packet,
* Table 2-3 - PID table, hls-mpeg-ts-iso13818-1.pdf, page 37
* NOTE - The transport packets with PID values 0x0000, 0x0001, and 0x0010-0x1FFE are allowed to carry a PCR.
*/
enum SrsTsPid
{
// Program Association Table(see Table 2-25).
SrsTsPidPAT = 0x00,
// Conditional Access Table (see Table 2-27).
SrsTsPidCAT = 0x01,
// Transport Stream Description Table
SrsTsPidTSDT = 0x02,
// Reserved
SrsTsPidReservedStart = 0x03,
SrsTsPidReservedEnd = 0x0f,
// May be assigned as network_PID, Program_map_PID, elementary_PID, or for other purposes
SrsTsPidAppStart = 0x10,
SrsTsPidAppEnd = 0x1ffe,
// null packets (see Table 2-3)
SrsTsPidNULL = 0x01FFF,
};
/**
* the transport_scrambling_control of ts packet,
* Table 2-4 - Scrambling control values, hls-mpeg-ts-iso13818-1.pdf, page 38
*/
enum SrsTsScrambled
{
// Not scrambled
SrsTsScrambledDisabled = 0x00,
// User-defined
SrsTsScrambledUserDefined1 = 0x01,
// User-defined
SrsTsScrambledUserDefined2 = 0x02,
// User-defined
SrsTsScrambledUserDefined3 = 0x03,
};
/**
* the adaption_field_control of ts packet,
* Table 2-5 - Adaptation field control values, hls-mpeg-ts-iso13818-1.pdf, page 38
*/
enum SrsTsAdaptationFieldType
{
// Reserved for future use by ISO/IEC
SrsTsAdaptationFieldTypeReserved = 0x00,
// No adaptation_field, payload only
SrsTsAdaptationFieldTypePayloadOnly = 0x01,
// Adaptation_field only, no payload
SrsTsAdaptationFieldTypeAdaptionOnly = 0x02,
// Adaptation_field followed by payload
SrsTsAdaptationFieldTypeBoth = 0x03,
};
/**
* the actually parsed ts pid,
* @see SrsTsPid, some pid, for example, PMT/Video/Audio is specified by PAT or other tables.
*/
enum SrsTsPidApply
{
SrsTsPidApplyReserved = 0, // TSPidTypeReserved, nothing parsed, used reserved.
SrsTsPidApplyPAT, // Program associtate table
SrsTsPidApplyPMT, // Program map table.
SrsTsPidApplyVideo, // for video
SrsTsPidApplyAudio, // vor audio
};
/**
* Table 2-29 - Stream type assignments
*/
enum SrsTsStream
{
// ITU-T | ISO/IEC Reserved
SrsTsStreamReserved = 0x00,
// ISO/IEC 11172 Video
// ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream
// ISO/IEC 11172 Audio
// ISO/IEC 13818-3 Audio
SrsTsStreamAudioMp3 = 0x04,
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
// ISO/IEC 13522 MHEG
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC
// ITU-T Rec. H.222.1
// ISO/IEC 13818-6 type A
// ISO/IEC 13818-6 type B
// ISO/IEC 13818-6 type C
// ISO/IEC 13818-6 type D
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
// ISO/IEC 13818-7 Audio with ADTS transport syntax
SrsTsStreamAudioAAC = 0x0f,
// ISO/IEC 14496-2 Visual
SrsTsStreamVideoMpeg4 = 0x10,
// ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
SrsTsStreamAudioMpeg4 = 0x11,
// ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
// ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections.
// ISO/IEC 13818-6 Synchronized Download Protocol
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
// 0x15-0x7F
SrsTsStreamVideoH264 = 0x1b,
// User Private
// 0x80-0xFF
SrsTsStreamAudioAC3 = 0x81,
SrsTsStreamAudioDTS = 0x8a,
};
std::string srs_ts_stream2string(SrsTsStream stream);
/**
* the ts channel.
*/
struct SrsTsChannel
{
int pid;
SrsTsPidApply apply;
SrsTsStream stream;
SrsTsMessage* msg;
SrsTsContext* context;
// for encoder.
u_int8_t continuity_counter;
SrsTsChannel();
virtual ~SrsTsChannel();
};
/**
* the stream_id of PES payload of ts packet.
* Table 2-18 - Stream_id assignments, hls-mpeg-ts-iso13818-1.pdf, page 52.
*/
enum SrsTsPESStreamId
{
// program_stream_map
SrsTsPESStreamIdProgramStreamMap = 0xbc, // 0b10111100
// private_stream_1
SrsTsPESStreamIdPrivateStream1 = 0xbd, // 0b10111101
// padding_stream
SrsTsPESStreamIdPaddingStream = 0xbe, // 0b10111110
// private_stream_2
SrsTsPESStreamIdPrivateStream2 = 0xbf, // 0b10111111
// 110x xxxx
// ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC
// 14496-3 audio stream number x xxxx
// ((sid >> 5) & 0x07) == SrsTsPESStreamIdAudio
// @remark, use SrsTsPESStreamIdAudioCommon as actually audio, SrsTsPESStreamIdAudio to check whether audio.
SrsTsPESStreamIdAudioChecker = 0x06, // 0b110
SrsTsPESStreamIdAudioCommon = 0xc0,
// 1110 xxxx
// ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC
// 14496-2 video stream number xxxx
// ((stream_id >> 4) & 0x0f) == SrsTsPESStreamIdVideo
// @remark, use SrsTsPESStreamIdVideoCommon as actually video, SrsTsPESStreamIdVideo to check whether video.
SrsTsPESStreamIdVideoChecker = 0x0e, // 0b1110
SrsTsPESStreamIdVideoCommon = 0xe0,
// ECM_stream
SrsTsPESStreamIdEcmStream = 0xf0, // 0b11110000
// EMM_stream
SrsTsPESStreamIdEmmStream = 0xf1, // 0b11110001
// DSMCC_stream
SrsTsPESStreamIdDsmccStream = 0xf2, // 0b11110010
// 13522_stream
SrsTsPESStreamId13522Stream = 0xf3, // 0b11110011
// H_222_1_type_A
SrsTsPESStreamIdH2221TypeA = 0xf4, // 0b11110100
// H_222_1_type_B
SrsTsPESStreamIdH2221TypeB = 0xf5, // 0b11110101
// H_222_1_type_C
SrsTsPESStreamIdH2221TypeC = 0xf6, // 0b11110110
// H_222_1_type_D
SrsTsPESStreamIdH2221TypeD = 0xf7, // 0b11110111
// H_222_1_type_E
SrsTsPESStreamIdH2221TypeE = 0xf8, // 0b11111000
// ancillary_stream
SrsTsPESStreamIdAncillaryStream = 0xf9, // 0b11111001
// SL_packetized_stream
SrsTsPESStreamIdSlPacketizedStream = 0xfa, // 0b11111010
// FlexMux_stream
SrsTsPESStreamIdFlexMuxStream = 0xfb, // 0b11111011
// reserved data stream
// 1111 1100 ... 1111 1110
// program_stream_directory
SrsTsPESStreamIdProgramStreamDirectory = 0xff, // 0b11111111
};
/**
* the media audio/video message parsed from PES packet.
*/
class SrsTsMessage
{
public:
// decoder only,
// the ts messgae does not use them,
// for user to get the channel and packet.
SrsTsChannel* channel;
SrsTsPacket* packet;
public:
// the audio cache buffer start pts, to flush audio if full.
// @remark the pts is not the adjust one, it's the orignal pts.
int64_t start_pts;
// whether this message with pcr info,
// generally, the video IDR(I frame, the keyframe of h.264) carray the pcr info.
bool write_pcr;
// whether got discontinuity ts, for example, sequence header changed.
bool is_discontinuity;
public:
// the timestamp in 90khz
int64_t dts;
int64_t pts;
// the id of pes stream to indicates the payload codec.
// @remark use is_audio() and is_video() to check it, and stream_number() to finger it out.
SrsTsPESStreamId sid;
// the size of payload, 0 indicates the length() of payload.
u_int16_t PES_packet_length;
// the chunk id.
u_int8_t continuity_counter;
// the payload bytes.
SrsSimpleBuffer* payload;
public:
SrsTsMessage(SrsTsChannel* c = NULL, SrsTsPacket* p = NULL);
virtual ~SrsTsMessage();
// decoder
public:
/**
* dumps all bytes in stream to ts message.
*/
virtual int dump(SrsStream* stream, int* pnb_bytes);
/**
* whether ts message is completed to reap.
* @param payload_unit_start_indicator whether new ts message start.
* PES_packet_length is 0, the payload_unit_start_indicator=1 to reap ts message.
* PES_packet_length > 0, the payload.length() == PES_packet_length to reap ts message.
* @remark when PES_packet_length>0, the payload_unit_start_indicator should never be 1 when not completed.
* @remark when fresh, the payload_unit_start_indicator should be 1.
*/
virtual bool completed(int8_t payload_unit_start_indicator);
/**
* whether the message is fresh.
*/
virtual bool fresh();
public:
/**
* whether the sid indicates the elementary stream audio.
*/
virtual bool is_audio();
/**
* whether the sid indicates the elementary stream video.
*/
virtual bool is_video();
/**
* when audio or video, get the stream number which specifies the format of stream.
* @return the stream number for audio/video; otherwise, -1.
*/
virtual int stream_number();
public:
/**
* detach the ts message,
* for user maybe need to parse the message by queue.
* @remark we always use the payload of original message.
*/
virtual SrsTsMessage* detach();
};
/**
* the ts message handler.
*/
class ISrsTsHandler
{
public:
ISrsTsHandler();
virtual ~ISrsTsHandler();
public:
/**
* when ts context got message, use handler to process it.
* @param msg the ts msg, user should never free it.
* @return an int error code.
*/
virtual int on_ts_message(SrsTsMessage* msg) = 0;
};
/**
* the context of ts, to decode the ts stream.
*/
class SrsTsContext
{
private:
// Whether context is ready, failed if try to write data when not ready.
// When PAT and PMT writen, the context is ready.
// @see https://github.com/ossrs/srs/issues/834
bool ready;
// codec
private:
std::map<int, SrsTsChannel*> pids;
bool pure_audio;
// encoder
private:
// when any codec changed, write the PAT/PMT.
SrsCodecVideo vcodec;
SrsCodecAudio acodec;
public:
SrsTsContext();
virtual ~SrsTsContext();
public:
/**
* whether the hls stream is pure audio stream.
*/
// TODO: FIXME: merge with muxer codec detect.
virtual bool is_pure_audio();
/**
* when PMT table parsed, we know some info about stream.
*/
virtual void on_pmt_parsed();
/**
* reset the context for a new ts segment start.
*/
virtual void reset();
// codec
public:
/**
* get the pid apply, the parsed pid.
* @return the apply channel; NULL for invalid.
*/
virtual SrsTsChannel* get(int pid);
/**
* set the pid apply, the parsed pid.
*/
virtual void set(int pid, SrsTsPidApply apply_pid, SrsTsStream stream = SrsTsStreamReserved);
// decode methods
public:
/**
* the stream contains only one ts packet.
* @param handler the ts message handler to process the msg.
* @remark we will consume all bytes in stream.
*/
virtual int decode(SrsStream* stream, ISrsTsHandler* handler);
int64_t program_clock_reference_base; //33bits
int16_t program_clock_reference_extension; //9bits
int64_t original_program_clock_reference_base; //33bits
int16_t original_program_clock_reference_extension; //9bits
// encode methods
public:
/**
* write the PES packet, the video/audio stream.
* @param msg the video/audio msg to write to ts.
* @param vc the video codec, write the PAT/PMT table when changed.
* @param ac the audio codec, write the PAT/PMT table when changed.
*/
virtual int encode(SrsFileWriter* writer, SrsTsMessage* msg, SrsCodecVideo vc, SrsCodecAudio ac);
private:
virtual int encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as);
virtual int encode_pes(SrsFileWriter* writer, SrsTsMessage* msg, int16_t pid, SrsTsStream sid, bool pure_audio);
};
/**
* the packet in ts stream,
* 2.4.3.2 Transport Stream packet layer, hls-mpeg-ts-iso13818-1.pdf, page 36
* Transport Stream packets shall be 188 bytes long.
*/
class SrsTsPacket
{
public:
// 1B
/**
* The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47). Sync_byte emulation in the choice of
* values for other regularly occurring fields, such as PID, should be avoided.
*/
int8_t sync_byte; //8bits
// 2B
/**
* The transport_error_indicator is a 1-bit flag. When set to '1' it indicates that at least
* 1 uncorrectable bit error exists in the associated Transport Stream packet. This bit may be set to '1' by entities external to
* the transport layer. When set to '1' this bit shall not be reset to '0' unless the bit value(s) in error have been corrected.
*/
int8_t transport_error_indicator; //1bit
/**
* The payload_unit_start_indicator is a 1-bit flag which has normative meaning for
* Transport Stream packets that carry PES packets (refer to 2.4.3.6) or PSI data (refer to 2.4.4).
*
* When the payload of the Transport Stream packet contains PES packet data, the payload_unit_start_indicator has the
* following significance: a '1' indicates that the payload of this Transport Stream packet will commence(start) with the first byte
* of a PES packet and a '0' indicates no PES packet shall start in this Transport Stream packet. If the
* payload_unit_start_indicator is set to '1', then one and only one PES packet starts in this Transport Stream packet. This
* also applies to private streams of stream_type 6 (refer to Table 2-29).
*
* When the payload of the Transport Stream packet contains PSI data, the payload_unit_start_indicator has the following
* significance: if the Transport Stream packet carries the first byte of a PSI section, the payload_unit_start_indicator value
* shall be '1', indicating that the first byte of the payload of this Transport Stream packet carries the pointer_field. If the
* Transport Stream packet does not carry the first byte of a PSI section, the payload_unit_start_indicator value shall be '0',
* indicating that there is no pointer_field in the payload. Refer to 2.4.4.1 and 2.4.4.2. This also applies to private streams of
* stream_type 5 (refer to Table 2-29).
*
* For null packets the payload_unit_start_indicator shall be set to '0'.
*
* The meaning of this bit for Transport Stream packets carrying only private data is not defined in this Specification.
*/
int8_t payload_unit_start_indicator; //1bit
/**
* The transport_priority is a 1-bit indicator. When set to '1' it indicates that the associated packet is
* of greater priority than other packets having the same PID which do not have the bit set to '1'. The transport mechanism
* can use this to prioritize its data within an elementary stream. Depending on the application the transport_priority field
* may be coded regardless of the PID or within one PID only. This field may be changed by channel specific encoders or
* decoders.
*/
int8_t transport_priority; //1bit
/**
* The PID is a 13-bit field, indicating the type of the data stored in the packet payload. PID value 0x0000 is
* reserved for the Program Association Table (see Table 2-25). PID value 0x0001 is reserved for the Conditional Access
* Table (see Table 2-27). PID values 0x0002 - 0x000F are reserved. PID value 0x1FFF is reserved for null packets (see
* Table 2-3).
*/
SrsTsPid pid; //13bits
// 1B
/**
* This 2-bit field indicates the scrambling mode of the Transport Stream packet payload.
* The Transport Stream packet header, and the adaptation field when present, shall not be scrambled. In the case of a null
* packet the value of the transport_scrambling_control field shall be set to '00' (see Table 2-4).
*/
SrsTsScrambled transport_scrambling_control; //2bits
/**
* This 2-bit field indicates whether this Transport Stream packet header is followed by an
* adaptation field and/or payload (see Table 2-5).
*
* ITU-T Rec. H.222.0 | ISO/IEC 13818-1 decoders shall discard Transport Stream packets with the
* adaptation_field_control field set to a value of '00'. In the case of a null packet the value of the adaptation_field_control
* shall be set to '01'.
*/
SrsTsAdaptationFieldType adaption_field_control; //2bits
/**
* The continuity_counter is a 4-bit field incrementing with each Transport Stream packet with the
* same PID. The continuity_counter wraps around to 0 after its maximum value. The continuity_counter shall not be
* incremented when the adaptation_field_control of the packet equals '00'(reseverd) or '10'(adaptation field only).
*
* In Transport Streams, duplicate packets may be sent as two, and only two, consecutive Transport Stream packets of the
* same PID. The duplicate packets shall have the same continuity_counter value as the original packet and the
* adaptation_field_control field shall be equal to '01'(payload only) or '11'(both). In duplicate packets each byte of the original packet shall be
* duplicated, with the exception that in the program clock reference fields, if present, a valid value shall be encoded.
*
* The continuity_counter in a particular Transport Stream packet is continuous when it differs by a positive value of one
* from the continuity_counter value in the previous Transport Stream packet of the same PID, or when either of the nonincrementing
* conditions (adaptation_field_control set to '00' or '10', or duplicate packets as described above) are met.
* The continuity counter may be discontinuous when the discontinuity_indicator is set to '1' (refer to 2.4.3.4). In the case of
* a null packet the value of the continuity_counter is undefined.
*/
u_int8_t continuity_counter; //4bits
int64_t program_clock_reference_base; //33bits
int16_t program_clock_reference_extension; //9bits
int64_t original_program_clock_reference_base; //33bits
int16_t original_program_clock_reference_extension; //9bits
private:
SrsTsAdaptationField* adaptation_field;
SrsTsPayload* payload;
public:
SrsTsContext* context;
public:
SrsTsPacket(SrsTsContext* c);
virtual ~SrsTsPacket();
public:
virtual int decode(SrsStream* stream, SrsTsMessage** ppmsg);
public:
virtual int size();
virtual int encode(SrsStream* stream);
virtual void padding(int nb_stuffings);
public:
static SrsTsPacket* create_pat(SrsTsContext* context,
int16_t pmt_number, int16_t pmt_pid
);
static SrsTsPacket* create_pmt(SrsTsContext* context,
int16_t pmt_number, int16_t pmt_pid, int16_t vpid, SrsTsStream vs,
int16_t apid, SrsTsStream as
);
static SrsTsPacket* create_pes_first(SrsTsContext* context,
int16_t pid, SrsTsPESStreamId sid, u_int8_t continuity_counter, bool discontinuity,
int64_t pcr, int64_t dts, int64_t pts, int size
);
static SrsTsPacket* create_pes_continue(SrsTsContext* context,
int16_t pid, SrsTsPESStreamId sid, u_int8_t continuity_counter
);
};
/**
* the adaption field of ts packet.
* 2.4.3.5 Semantic definition of fields in adaptation field, hls-mpeg-ts-iso13818-1.pdf, page 39
* Table 2-6 - Transport Stream adaptation field, hls-mpeg-ts-iso13818-1.pdf, page 40
*/
class SrsTsAdaptationField
{
public:
// 1B
/**
* The adaptation_field_length is an 8-bit field specifying the number of bytes in the
* adaptation_field immediately following the adaptation_field_length. The value 0 is for inserting a single stuffing byte in
* a Transport Stream packet. When the adaptation_field_control value is '11', the value of the adaptation_field_length shall
* be in the range 0 to 182. When the adaptation_field_control value is '10', the value of the adaptation_field_length shall
* be 183. For Transport Stream packets carrying PES packets, stuffing is needed when there is insufficient PES packet data
* to completely fill the Transport Stream packet payload bytes. Stuffing is accomplished by defining an adaptation field
* longer than the sum of the lengths of the data elements in it, so that the payload bytes remaining after the adaptation field
* exactly accommodates the available PES packet data. The extra space in the adaptation field is filled with stuffing bytes.
*
* This is the only method of stuffing allowed for Transport Stream packets carrying PES packets. For Transport Stream
* packets carrying PSI, an alternative stuffing method is described in 2.4.4.
*/
u_int8_t adaption_field_length; //8bits
// 1B
/**
* This is a 1-bit field which when set to '1' indicates that the discontinuity state is true for the
* current Transport Stream packet. When the discontinuity_indicator is set to '0' or is not present, the discontinuity state is
* false. The discontinuity indicator is used to indicate two types of discontinuities, system time-base discontinuities and
* continuity_counter discontinuities.
*
* A system time-base discontinuity is indicated by the use of the discontinuity_indicator in Transport Stream packets of a
* PID designated as a PCR_PID (refer to 2.4.4.9). When the discontinuity state is true for a Transport Stream packet of a
* PID designated as a PCR_PID, the next PCR in a Transport Stream packet with that same PID represents a sample of a
* new system time clock for the associated program. The system time-base discontinuity point is defined to be the instant
* in time when the first byte of a packet containing a PCR of a new system time-base arrives at the input of the T-STD.
* The discontinuity_indicator shall be set to '1' in the packet in which the system time-base discontinuity occurs. The
* discontinuity_indicator bit may also be set to '1' in Transport Stream packets of the same PCR_PID prior to the packet
* which contains the new system time-base PCR. In this case, once the discontinuity_indicator has been set to '1', it shall
* continue to be set to '1' in all Transport Stream packets of the same PCR_PID up to and including the Transport Stream
* packet which contains the first PCR of the new system time-base. After the occurrence of a system time-base
* discontinuity, no fewer than two PCRs for the new system time-base shall be received before another system time-base
* discontinuity can occur. Further, except when trick mode status is true, data from no more than two system time-bases
* shall be present in the set of T-STD buffers for one program at any time.
*
* Prior to the occurrence of a system time-base discontinuity, the first byte of a Transport Stream packet which contains a
* PTS or DTS which refers to the new system time-base shall not arrive at the input of the T-STD. After the occurrence of
* a system time-base discontinuity, the first byte of a Transport Stream packet which contains a PTS or DTS which refers
* to the previous system time-base shall not arrive at the input of the T-STD.
*
* A continuity_counter discontinuity is indicated by the use of the discontinuity_indicator in any Transport Stream packet.
* When the discontinuity state is true in any Transport Stream packet of a PID not designated as a PCR_PID, the
* continuity_counter in that packet may be discontinuous with respect to the previous Transport Stream packet of the same
* PID. When the discontinuity state is true in a Transport Stream packet of a PID that is designated as a PCR_PID, the
* continuity_counter may only be discontinuous in the packet in which a system time-base discontinuity occurs. A
* continuity counter discontinuity point occurs when the discontinuity state is true in a Transport Stream packet and the
* continuity_counter in the same packet is discontinuous with respect to the previous Transport Stream packet of the same
* PID. A continuity counter discontinuity point shall occur at most one time from the initiation of the discontinuity state
* until the conclusion of the discontinuity state. Furthermore, for all PIDs that are not designated as PCR_PIDs, when the
* discontinuity_indicator is set to '1' in a packet of a specific PID, the discontinuity_indicator may be set to '1' in the next
* Transport Stream packet of that same PID, but shall not be set to '1' in three consecutive Transport Stream packet of that
* same PID.
*
* For the purpose of this clause, an elementary stream access point is defined as follows:
* Video - The first byte of a video sequence header.
* Audio - The first byte of an audio frame.
*
* After a continuity counter discontinuity in a Transport packet which is designated as containing elementary stream data,
* the first byte of elementary stream data in a Transport Stream packet of the same PID shall be the first byte of an
* elementary stream access point or in the case of video, the first byte of an elementary stream access point or a
* sequence_end_code followed by an access point. Each Transport Stream packet which contains elementary stream data
* with a PID not designated as a PCR_PID, and in which a continuity counter discontinuity point occurs, and in which a
* PTS or DTS occurs, shall arrive at the input of the T-STD after the system time-base discontinuity for the associated
* program occurs. In the case where the discontinuity state is true, if two consecutive Transport Stream packets of the same
* PID occur which have the same continuity_counter value and have adaptation_field_control values set to '01' or '11', the
* second packet may be discarded. A Transport Stream shall not be constructed in such a way that discarding such a packet
* will cause the loss of PES packet payload data or PSI data.
*
* After the occurrence of a discontinuity_indicator set to '1' in a Transport Stream packet which contains PSI information,
* a single discontinuity in the version_number of PSI sections may occur. At the occurrence of such a discontinuity, a
* version of the TS_program_map_sections of the appropriate program shall be sent with section_length = = 13 and the
* current_next_indicator = = 1, such that there are no program_descriptors and no elementary streams described. This shall
* then be followed by a version of the TS_program_map_section for each affected program with the version_number
* incremented by one and the current_next_indicator = = 1, containing a complete program definition. This indicates a
* version change in PSI data.
*/
int8_t discontinuity_indicator; //1bit
/**
* The random_access_indicator is a 1-bit field that indicates that the current Transport
* Stream packet, and possibly subsequent Transport Stream packets with the same PID, contain some information to aid
* random access at this point. Specifically, when the bit is set to '1', the next PES packet to start in the payload of Transport
* Stream packets with the current PID shall contain the first byte of a video sequence header if the PES stream type (refer
* to Table 2-29) is 1 or 2, or shall contain the first byte of an audio frame if the PES stream type is 3 or 4. In addition, in
* the case of video, a presentation timestamp shall be present in the PES packet containing the first picture following the
* sequence header. In the case of audio, the presentation timestamp shall be present in the PES packet containing the first
* byte of the audio frame. In the PCR_PID the random_access_indicator may only be set to '1' in Transport Stream packet
* containing the PCR fields.
*/
int8_t random_access_indicator; //1bit
/**
* The elementary_stream_priority_indicator is a 1-bit field. It indicates, among
* packets with the same PID, the priority of the elementary stream data carried within the payload of this Transport Stream
* packet. A '1' indicates that the payload has a higher priority than the payloads of other Transport Stream packets. In the
* case of video, this field may be set to '1' only if the payload contains one or more bytes from an intra-coded slice. A
* value of '0' indicates that the payload has the same priority as all other packets which do not have this bit set to '1'.
*/
int8_t elementary_stream_priority_indicator; //1bit
/**
* The PCR_flag is a 1-bit flag. A value of '1' indicates that the adaptation_field contains a PCR field coded in
* two parts. A value of '0' indicates that the adaptation field does not contain any PCR field.
*/
int8_t PCR_flag; //1bit
/**
* The OPCR_flag is a 1-bit flag. A value of '1' indicates that the adaptation_field contains an OPCR field
* coded in two parts. A value of '0' indicates that the adaptation field does not contain any OPCR field.
*/
int8_t OPCR_flag; //1bit
/**
* The splicing_point_flag is a 1-bit flag. When set to '1', it indicates that a splice_countdown field
* shall be present in the associated adaptation field, specifying the occurrence of a splicing point. A value of '0' indicates
* that a splice_countdown field is not present in the adaptation field.
*/
int8_t splicing_point_flag; //1bit
/**
* The transport_private_data_flag is a 1-bit flag. A value of '1' indicates that the
* adaptation field contains one or more private_data bytes. A value of '0' indicates the adaptation field does not contain any
* private_data bytes.
*/
int8_t transport_private_data_flag; //1bit
/**
* The adaptation_field_extension_flag is a 1-bit field which when set to '1' indicates
* the presence of an adaptation field extension. A value of '0' indicates that an adaptation field extension is not present in
* the adaptation field.
*/
int8_t adaptation_field_extension_flag; //1bit
// if PCR_flag, 6B
/**
* The program_clock_reference (PCR) is a
* 42-bit field coded in two parts. The first part, program_clock_reference_base, is a 33-bit field whose value is given by
* PCR_base(i), as given in equation 2-2. The second part, program_clock_reference_extension, is a 9-bit field whose value
* is given by PCR_ext(i), as given in equation 2-3. The PCR indicates the intended time of arrival of the byte containing
* the last bit of the program_clock_reference_base at the input of the system target decoder.
*/
int64_t program_clock_reference_base; //33bits
/**
* 6bits reserved, must be '1'
*/
int8_t const1_value0; // 6bits
int16_t program_clock_reference_extension; //9bits
// if OPCR_flag, 6B
/**
* The optional original
* program reference (OPCR) is a 42-bit field coded in two parts. These two parts, the base and the extension, are coded
* identically to the two corresponding parts of the PCR field. The presence of the OPCR is indicated by the OPCR_flag.
* The OPCR field shall be coded only in Transport Stream packets in which the PCR field is present. OPCRs are permitted
* in both single program and multiple program Transport Streams.
*
* OPCR assists in the reconstruction of a single program Transport Stream from another Transport Stream. When
* reconstructing the original single program Transport Stream, the OPCR may be copied to the PCR field. The resulting
* PCR value is valid only if the original single program Transport Stream is reconstructed exactly in its entirety. This
* would include at least any PSI and private data packets which were present in the original Transport Stream and would
* possibly require other private arrangements. It also means that the OPCR must be an identical copy of its associated PCR
* in the original single program Transport Stream.
*/
int64_t original_program_clock_reference_base; //33bits
/**
* 6bits reserved, must be '1'
*/
int8_t const1_value2; // 6bits
int16_t original_program_clock_reference_extension; //9bits
// if splicing_point_flag, 1B
/**
* The splice_countdown is an 8-bit field, representing a value which may be positive or negative. A
* positive value specifies the remaining number of Transport Stream packets, of the same PID, following the associated
* Transport Stream packet until a splicing point is reached. Duplicate Transport Stream packets and Transport Stream
* packets which only contain adaptation fields are excluded. The splicing point is located immediately after the last byte of
* the Transport Stream packet in which the associated splice_countdown field reaches zero. In the Transport Stream packet
* where the splice_countdown reaches zero, the last data byte of the Transport Stream packet payload shall be the last byte
* of a coded audio frame or a coded picture. In the case of video, the corresponding access unit may or may not be
* terminated by a sequence_end_code. Transport Stream packets with the same PID, which follow, may contain data from
* a different elementary stream of the same type.
*
* The payload of the next Transport Stream packet of the same PID (duplicate packets and packets without payload being
* excluded) shall commence with the first byte of a PES packet.In the case of audio, the PES packet payload shall
* commence with an access point. In the case of video, the PES packet payload shall commence with an access point, or
* with a sequence_end_code, followed by an access point. Thus, the previous coded audio frame or coded picture aligns
* with the packet boundary, or is padded to make this so. Subsequent to the splicing point, the countdown field may also
* be present. When the splice_countdown is a negative number whose value is minus n(-n), it indicates that the associated
* Transport Stream packet is the n-th packet following the splicing point (duplicate packets and packets without payload
* being excluded).
*
* For the purposes of this subclause, an access point is defined as follows:
* Video - The first byte of a video_sequence_header.
* Audio - The first byte of an audio frame.
*/
int8_t splice_countdown; //8bits
// if transport_private_data_flag, 1+p[0] B
/**
* The transport_private_data_length is an 8-bit field specifying the number of
* private_data bytes immediately following the transport private_data_length field. The number of private_data bytes shall
* not be such that private data extends beyond the adaptation field.
*/
u_int8_t transport_private_data_length; //8bits
char* transport_private_data; //[transport_private_data_length]bytes
// if adaptation_field_extension_flag, 2+x B
/**
* The adaptation_field_extension_length is an 8-bit field. It indicates the number of
* bytes of the extended adaptation field data immediately following this field, including reserved bytes if present.
*/
u_int8_t adaptation_field_extension_length; //8bits
/**
* This is a 1-bit field which when set to '1' indicates the presence of the ltw_offset
* field.
*/
int8_t ltw_flag; //1bit
/**
* This is a 1-bit field which when set to '1' indicates the presence of the piecewise_rate field.
*/
int8_t piecewise_rate_flag; //1bit
/**
* This is a 1-bit flag which when set to '1' indicates that the splice_type and DTS_next_AU fields
* are present. A value of '0' indicates that neither splice_type nor DTS_next_AU fields are present. This field shall not be
* set to '1' in Transport Stream packets in which the splicing_point_flag is not set to '1'. Once it is set to '1' in a Transport
* Stream packet in which the splice_countdown is positive, it shall be set to '1' in all the subsequent Transport Stream
* packets of the same PID that have the splicing_point_flag set to '1', until the packet in which the splice_countdown
* reaches zero (including this packet). When this flag is set, if the elementary stream carried in this PID is an audio stream,
* the splice_type field shall be set to '0000'. If the elementary stream carried in this PID is a video stream, it shall fulfil the
* constraints indicated by the splice_type value.
*/
int8_t seamless_splice_flag; //1bit
/**
* reserved 5bits, must be '1'
*/
int8_t const1_value1; //5bits
// if ltw_flag, 2B
/**
* (legal time window_valid_flag) - This is a 1-bit field which when set to '1' indicates that the value of the
* ltw_offset shall be valid. A value of '0' indicates that the value in the ltw_offset field is undefined.
*/
int8_t ltw_valid_flag; //1bit
/**
* (legal time window offset) - This is a 15-bit field, the value of which is defined only if the ltw_valid flag has
* a value of '1'. When defined, the legal time window offset is in units of (300/fs) seconds, where fs is the system clock
* frequency of the program that this PID belongs to, and fulfils:
* offset = t1(i) - t(i)
* ltw_offset = offset//1
* where i is the index of the first byte of this Transport Stream packet, offset is the value encoded in this field, t(i) is the
* arrival time of byte i in the T-STD, and t1(i) is the upper bound in time of a time interval called the Legal Time Window
* which is associated with this Transport Stream packet.
*/
int16_t ltw_offset; //15bits
// if piecewise_rate_flag, 3B
//2bits reserved
/**
* The meaning of this 22-bit field is only defined when both the ltw_flag and the ltw_valid_flag are set
* to '1'. When defined, it is a positive integer specifying a hypothetical bitrate R which is used to define the end times of
* the Legal Time Windows of Transport Stream packets of the same PID that follow this packet but do not include the
* legal_time_window_offset field.
*/
int32_t piecewise_rate; //22bits
// if seamless_splice_flag, 5B
/**
* This is a 4-bit field. From the first occurrence of this field onwards, it shall have the same value in all the
* subsequent Transport Stream packets of the same PID in which it is present, until the packet in which the
* splice_countdown reaches zero (including this packet). If the elementary stream carried in that PID is an audio stream,
* this field shall have the value '0000'. If the elementary stream carried in that PID is a video stream, this field indicates the
* conditions that shall be respected by this elementary stream for splicing purposes. These conditions are defined as a
* function of profile, level and splice_type in Table 2-7 through Table 2-16.
*/
int8_t splice_type; //4bits
/**
* (decoding time stamp next access unit) - This is a 33-bit field, coded in three parts. In the case of
* continuous and periodic decoding through this splicing point it indicates the decoding time of the first access unit
* following the splicing point. This decoding time is expressed in the time base which is valid in the Transport Stream
* packet in which the splice_countdown reaches zero. From the first occurrence of this field onwards, it shall have the
* same value in all the subsequent Transport Stream packets of the same PID in which it is present, until the packet in
* which the splice_countdown reaches zero (including this packet).
*/
int8_t DTS_next_AU0; //3bits
int8_t marker_bit0; //1bit
int16_t DTS_next_AU1; //15bits
int8_t marker_bit1; //1bit
int16_t DTS_next_AU2; //15bits
int8_t marker_bit2; //1bit
// left bytes.
/**
* This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder. It is discarded by the
* decoder.
*/
int nb_af_ext_reserved;
// left bytes.
/**
* This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder. It is discarded by the
* decoder.
*/
int nb_af_reserved;
private:
SrsTsPacket* packet;
public:
SrsTsAdaptationField(SrsTsPacket* pkt);
virtual ~SrsTsAdaptationField();
public:
virtual int decode(SrsStream* stream);
public:
virtual int size();
virtual int encode(SrsStream* stream);
};
/**
* 2.4.4.4 Table_id assignments, hls-mpeg-ts-iso13818-1.pdf, page 62
* The table_id field identifies the contents of a Transport Stream PSI section as shown in Table 2-26.
*/
enum SrsTsPsiId
{
// program_association_section
SrsTsPsiIdPas = 0x00,
// conditional_access_section (CA_section)
SrsTsPsiIdCas = 0x01,
// TS_program_map_section
SrsTsPsiIdPms = 0x02,
// TS_description_section
SrsTsPsiIdDs = 0x03,
// ISO_IEC_14496_scene_description_section
SrsTsPsiIdSds = 0x04,
// ISO_IEC_14496_object_descriptor_section
SrsTsPsiIdOds = 0x05,
// ITU-T Rec. H.222.0 | ISO/IEC 13818-1 reserved
SrsTsPsiIdIso138181Start = 0x06,
SrsTsPsiIdIso138181End = 0x37,
// Defined in ISO/IEC 13818-6
SrsTsPsiIdIso138186Start = 0x38,
SrsTsPsiIdIso138186End = 0x3F,
// User private
SrsTsPsiIdUserStart = 0x40,
SrsTsPsiIdUserEnd = 0xFE,
// forbidden
SrsTsPsiIdForbidden = 0xFF,
};
/**
* the payload of ts packet, can be PES or PSI payload.
*/
class SrsTsPayload
{
protected:
SrsTsPacket* packet;
public:
SrsTsPayload(SrsTsPacket* p);
virtual ~SrsTsPayload();
public:
virtual int decode(SrsStream* stream, SrsTsMessage** ppmsg) = 0;
public:
virtual int size() = 0;
virtual int encode(SrsStream* stream) = 0;
};
/**
* the PES payload of ts packet.
* 2.4.3.6 PES packet, hls-mpeg-ts-iso13818-1.pdf, page 49
*/
class SrsTsPayloadPES : public SrsTsPayload
{
public:
// 3B
/**
* The packet_start_code_prefix is a 24-bit code. Together with the stream_id that follows it
* constitutes a packet start code that identifies the beginning of a packet. The packet_start_code_prefix is the bit string
* '0000 0000 0000 0000 0000 0001' (0x000001).
*/
int32_t packet_start_code_prefix; //24bits
// 1B
/**
* In Program Streams, the stream_id specifies the type and number of the elementary stream as defined by the
* stream_id Table 2-18. In Transport Streams, the stream_id may be set to any valid value which correctly describes the
* elementary stream type as defined in Table 2-18. In Transport Streams, the elementary stream type is specified in the
* Program Specific Information as specified in 2.4.4.
*/
// @see SrsTsPESStreamId, value can be SrsTsPESStreamIdAudioCommon or SrsTsPESStreamIdVideoCommon.
u_int8_t stream_id; //8bits
// 2B
/**
* A 16-bit field specifying the number of bytes in the PES packet following the last byte of the
* field. A value of 0 indicates that the PES packet length is neither specified nor bounded and is allowed only in
* PES packets whose payload consists of bytes from a video elementary stream contained in Transport Stream packets.
*/
u_int16_t PES_packet_length; //16bits
// 1B
/**
* 2bits const '10'
*/
int8_t const2bits; //2bits
/**
* The 2-bit PES_scrambling_control field indicates the scrambling mode of the PES packet
* payload. When scrambling is performed at the PES level, the PES packet header, including the optional fields when
* present, shall not be scrambled (see Table 2-19).
*/
int8_t PES_scrambling_control; //2bits
/**
* This is a 1-bit field indicating the priority of the payload in this PES packet. A '1' indicates a higher
* priority of the payload of the PES packet payload than a PES packet payload with this field set to '0'. A multiplexor can
* use the PES_priority bit to prioritize its data within an elementary stream. This field shall not be changed by the transport
* mechanism.
*/
int8_t PES_priority; //1bit
/**
* This is a 1-bit flag. When set to a value of '1' it indicates that the PES packet header is
* immediately followed by the video start code or audio syncword indicated in the data_stream_alignment_descriptor
* in 2.6.10 if this descriptor is present. If set to a value of '1' and the descriptor is not present, alignment as indicated in
* alignment_type '01' in Table 2-47 and Table 2-48 is required. When set to a value of '0' it is not defined whether any such
* alignment occurs or not.
*/
int8_t data_alignment_indicator; //1bit
/**
* This is a 1-bit field. When set to '1' it indicates that the material of the associated PES packet payload is
* protected by copyright. When set to '0' it is not defined whether the material is protected by copyright. A copyright
* descriptor described in 2.6.24 is associated with the elementary stream which contains this PES packet and the copyright
* flag is set to '1' if the descriptor applies to the material contained in this PES packet
*/
int8_t copyright; //1bit
/**
* This is a 1-bit field. When set to '1' the contents of the associated PES packet payload is an original.
* When set to '0' it indicates that the contents of the associated PES packet payload is a copy.
*/
int8_t original_or_copy; //1bit
// 1B
/**
* This is a 2-bit field. When the PTS_DTS_flags field is set to '10', the PTS fields shall be present in
* the PES packet header. When the PTS_DTS_flags field is set to '11', both the PTS fields and DTS fields shall be present
* in the PES packet header. When the PTS_DTS_flags field is set to '00' no PTS or DTS fields shall be present in the PES
* packet header. The value '01' is forbidden.
*/
int8_t PTS_DTS_flags; //2bits
/**
* A 1-bit flag, which when set to '1' indicates that ESCR base and extension fields are present in the PES
* packet header. When set to '0' it indicates that no ESCR fields are present.
*/
int8_t ESCR_flag; //1bit
/**
* A 1-bit flag, which when set to '1' indicates that the ES_rate field is present in the PES packet header.
* When set to '0' it indicates that no ES_rate field is present.
*/
int8_t ES_rate_flag; //1bit
/**
* A 1-bit flag, which when set to '1' it indicates the presence of an 8-bit trick mode field. When
* set to '0' it indicates that this field is not present.
*/
int8_t DSM_trick_mode_flag; //1bit
/**
* A 1-bit flag, which when set to '1' indicates the presence of the additional_copy_info field.
* When set to '0' it indicates that this field is not present.
*/
int8_t additional_copy_info_flag; //1bit
/**
* A 1-bit flag, which when set to '1' indicates that a CRC field is present in the PES packet. When set to
* '0' it indicates that this field is not present.
*/
int8_t PES_CRC_flag; //1bit
/**
* A 1-bit flag, which when set to '1' indicates that an extension field exists in this PES packet
* header. When set to '0' it indicates that this field is not present.
*/
int8_t PES_extension_flag; //1bit
// 1B
/**
* An 8-bit field specifying the total number of bytes occupied by the optional fields and any
* stuffing bytes contained in this PES packet header. The presence of optional fields is indicated in the byte that precedes
* the PES_header_data_length field.
*/
u_int8_t PES_header_data_length; //8bits
// 5B
/**
* Presentation times shall be related to decoding times as follows: The PTS is a 33-bit
* number coded in three separate fields. It indicates the time of presentation, tp n (k), in the system target decoder of a
* presentation unit k of elementary stream n. The value of PTS is specified in units of the period of the system clock
* frequency divided by 300 (yielding 90 kHz). The presentation time is derived from the PTS according to equation 2-11
* below. Refer to 2.7.4 for constraints on the frequency of coding presentation timestamps.
*/
// ===========1B
// 4bits const
// 3bits PTS [32..30]
// 1bit const '1'
// ===========2B
// 15bits PTS [29..15]
// 1bit const '1'
// ===========2B
// 15bits PTS [14..0]
// 1bit const '1'
int64_t pts; // 33bits
// 5B
/**
* The DTS is a 33-bit number coded in three separate fields. It indicates the decoding time,
* td n (j), in the system target decoder of an access unit j of elementary stream n. The value of DTS is specified in units of
* the period of the system clock frequency divided by 300 (yielding 90 kHz).
*/
// ===========1B
// 4bits const
// 3bits DTS [32..30]
// 1bit const '1'
// ===========2B
// 15bits DTS [29..15]
// 1bit const '1'
// ===========2B
// 15bits DTS [14..0]
// 1bit const '1'
int64_t dts; // 33bits
// 6B
/**
* The elementary stream clock reference is a 42-bit field coded in two parts. The first
* part, ESCR_base, is a 33-bit field whose value is given by ESCR_base(i), as given in equation 2-14. The second part,
* ESCR_ext, is a 9-bit field whose value is given by ESCR_ext(i), as given in equation 2-15. The ESCR field indicates the
* intended time of arrival of the byte containing the last bit of the ESCR_base at the input of the PES-STD for PES streams
* (refer to 2.5.2.4).
*/
// 2bits reserved
// 3bits ESCR_base[32..30]
// 1bit const '1'
// 15bits ESCR_base[29..15]
// 1bit const '1'
// 15bits ESCR_base[14..0]
// 1bit const '1'
// 9bits ESCR_extension
// 1bit const '1'
int64_t ESCR_base; //33bits
int16_t ESCR_extension; //9bits
// 3B
/**
* The ES_rate field is a 22-bit unsigned integer specifying the rate at which the
* system target decoder receives bytes of the PES packet in the case of a PES stream. The ES_rate is valid in the PES
* packet in which it is included and in subsequent PES packets of the same PES stream until a new ES_rate field is
* encountered. The value of the ES_rate is measured in units of 50 bytes/second. The value 0 is forbidden. The value of the
* ES_rate is used to define the time of arrival of bytes at the input of a P-STD for PES streams defined in 2.5.2.4. The
* value encoded in the ES_rate field may vary from PES_packet to PES_packet.
*/
// 1bit const '1'
// 22bits ES_rate
// 1bit const '1'
int32_t ES_rate; //22bits
// 1B
/**
* A 3-bit field that indicates which trick mode is applied to the associated video stream. In cases of
* other types of elementary streams, the meanings of this field and those defined by the following five bits are undefined.
* For the definition of trick_mode status, refer to the trick mode section of 2.4.2.3.
*/
int8_t trick_mode_control; //3bits
int8_t trick_mode_value; //5bits
// 1B
// 1bit const '1'
/**
* This 7-bit field contains private data relating to copyright information.
*/
int8_t additional_copy_info; //7bits
// 2B
/**
* The previous_PES_packet_CRC is a 16-bit field that contains the CRC value that yields
* a zero output of the 16 registers in the decoder similar to the one defined in Annex A,
*/
int16_t previous_PES_packet_CRC; //16bits
// 1B
/**
* A 1-bit flag which when set to '1' indicates that the PES packet header contains private data.
* When set to a value of '0' it indicates that private data is not present in the PES header.
*/
int8_t PES_private_data_flag; //1bit
/**
* A 1-bit flag which when set to '1' indicates that an ISO/IEC 11172-1 pack header or a
* Program Stream pack header is stored in this PES packet header. If this field is in a PES packet that is contained in a
* Program Stream, then this field shall be set to '0'. In a Transport Stream, when set to the value '0' it indicates that no pack
* header is present in the PES header.
*/
int8_t pack_header_field_flag; //1bit
/**
* A 1-bit flag which when set to '1' indicates that the
* program_packet_sequence_counter, MPEG1_MPEG2_identifier, and original_stuff_length fields are present in this
* PES packet. When set to a value of '0' it indicates that these fields are not present in the PES header.
*/
int8_t program_packet_sequence_counter_flag; //1bit
/**
* A 1-bit flag which when set to '1' indicates that the P-STD_buffer_scale and P-STD_buffer_size
* are present in the PES packet header. When set to a value of '0' it indicates that these fields are not present in the
* PES header.
*/
int8_t P_STD_buffer_flag; //1bit
/**
* reverved value, must be '1'
*/
int8_t const1_value0; //3bits
/**
* A 1-bit field which when set to '1' indicates the presence of the PES_extension_field_length
* field and associated fields. When set to a value of '0' this indicates that the PES_extension_field_length field and any
* associated fields are not present.
*/
int8_t PES_extension_flag_2; //1bit
// 16B
/**
* This is a 16-byte field which contains private data. This data, combined with the fields before and
* after, shall not emulate the packet_start_code_prefix (0x000001).
*/
char* PES_private_data; //128bits
// (1+x)B
/**
* This is an 8-bit field which indicates the length, in bytes, of the pack_header_field().
*/
u_int8_t pack_field_length; //8bits
char* pack_field; //[pack_field_length] bytes
// 2B
// 1bit const '1'
/**
* The program_packet_sequence_counter field is a 7-bit field. It is an optional
* counter that increments with each successive PES packet from a Program Stream or from an ISO/IEC 11172-1 Stream or
* the PES packets associated with a single program definition in a Transport Stream, providing functionality similar to a
* continuity counter (refer to 2.4.3.2). This allows an application to retrieve the original PES packet sequence of a Program
* Stream or the original packet sequence of the original ISO/IEC 11172-1 stream. The counter will wrap around to 0 after
* its maximum value. Repetition of PES packets shall not occur. Consequently, no two consecutive PES packets in the
* program multiplex shall have identical program_packet_sequence_counter values.
*/
int8_t program_packet_sequence_counter; //7bits
// 1bit const '1'
/**
* A 1-bit flag which when set to '1' indicates that this PES packet carries information from
* an ISO/IEC 11172-1 stream. When set to '0' it indicates that this PES packet carries information from a Program Stream.
*/
int8_t MPEG1_MPEG2_identifier; //1bit
/**
* This 6-bit field specifies the number of stuffing bytes used in the original ITU-T
* Rec. H.222.0 | ISO/IEC 13818-1 PES packet header or in the original ISO/IEC 11172-1 packet header.
*/
int8_t original_stuff_length; //6bits
// 2B
// 2bits const '01'
/**
* The P-STD_buffer_scale is a 1-bit field, the meaning of which is only defined if this PES packet
* is contained in a Program Stream. It indicates the scaling factor used to interpret the subsequent P-STD_buffer_size field.
* If the preceding stream_id indicates an audio stream, P-STD_buffer_scale shall have the value '0'. If the preceding
* stream_id indicates a video stream, P-STD_buffer_scale shall have the value '1'. For all other stream types, the value
* may be either '1' or '0'.
*/
int8_t P_STD_buffer_scale; //1bit
/**
* The P-STD_buffer_size is a 13-bit unsigned integer, the meaning of which is only defined if this
* PES packet is contained in a Program Stream. It defines the size of the input buffer, BS n , in the P-STD. If
* P-STD_buffer_scale has the value '0', then the P-STD_buffer_size measures the buffer size in units of 128 bytes. If
* P-STD_buffer_scale has the value '1', then the P-STD_buffer_size measures the buffer size in units of 1024 bytes.
*/
int16_t P_STD_buffer_size; //13bits
// (1+x)B
// 1bit const '1'
/**
* This is a 7-bit field which specifies the length, in bytes, of the data following this field in
* the PES extension field up to and including any reserved bytes.
*/
u_int8_t PES_extension_field_length; //7bits
char* PES_extension_field; //[PES_extension_field_length] bytes
// NB
/**
* This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder, for example to meet
* the requirements of the channel. It is discarded by the decoder. No more than 32 stuffing bytes shall be present in one
* PES packet header.
*/
int nb_stuffings;
// NB
/**
* PES_packet_data_bytes shall be contiguous bytes of data from the elementary stream
* indicated by the packet's stream_id or PID. When the elementary stream data conforms to ITU-T
* Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 13818-3, the PES_packet_data_bytes shall be byte aligned to the bytes of this
* Recommendation | International Standard. The byte-order of the elementary stream shall be preserved. The number of
* PES_packet_data_bytes, N, is specified by the PES_packet_length field. N shall be equal to the value indicated in the
* PES_packet_length minus the number of bytes between the last byte of the PES_packet_length field and the first
* PES_packet_data_byte.
*
* In the case of a private_stream_1, private_stream_2, ECM_stream, or EMM_stream, the contents of the
* PES_packet_data_byte field are user definable and will not be specified by ITU-T | ISO/IEC in the future.
*/
int nb_bytes;
// NB
/**
* This is a fixed 8-bit value equal to '1111 1111'. It is discarded by the decoder.
*/
int nb_paddings;
public:
SrsTsPayloadPES(SrsTsPacket* p);
virtual ~SrsTsPayloadPES();
public:
virtual int decode(SrsStream* stream, SrsTsMessage** ppmsg);
public:
virtual int size();
virtual int encode(SrsStream* stream);
private:
virtual int decode_33bits_dts_pts(SrsStream* stream, int64_t* pv);
virtual int encode_33bits_dts_pts(SrsStream* stream, u_int8_t fb, int64_t v);
};
/**
* the PSI payload of ts packet.
* 2.4.4 Program specific information, hls-mpeg-ts-iso13818-1.pdf, page 59
*/
class SrsTsPayloadPSI : public SrsTsPayload
{
public:
// 1B
/**
* This is an 8-bit field whose value shall be the number of bytes, immediately following the pointer_field
* until the first byte of the first section that is present in the payload of the Transport Stream packet (so a value of 0x00 in
* the pointer_field indicates that the section starts immediately after the pointer_field). When at least one section begins in
* a given Transport Stream packet, then the payload_unit_start_indicator (refer to 2.4.3.2) shall be set to 1 and the first
* byte of the payload of that Transport Stream packet shall contain the pointer. When no section begins in a given
* Transport Stream packet, then the payload_unit_start_indicator shall be set to 0 and no pointer shall be sent in the
* payload of that packet.
*/
int8_t pointer_field;
public:
// 1B
/**
* This is an 8-bit field, which shall be set to 0x00 as shown in Table 2-26.
*/
SrsTsPsiId table_id; //8bits
// 2B
/**
* The section_syntax_indicator is a 1-bit field which shall be set to '1'.
*/
int8_t section_syntax_indicator; //1bit
/**
* const value, must be '0'
*/
int8_t const0_value; //1bit
/**
* reverved value, must be '1'
*/
int8_t const1_value; //2bits
/**
* This is a 12-bit field, the first two bits of which shall be '00'. The remaining 10 bits specify the number
* of bytes of the section, starting immediately following the section_length field, and including the CRC. The value in this
* field shall not exceed 1021 (0x3FD).
*/
u_int16_t section_length; //12bits
public:
// the specified psi info, for example, PAT fields.
public:
// 4B
/**
* This is a 32-bit field that contains the CRC value that gives a zero output of the registers in the decoder
* defined in Annex A after processing the entire section.
* @remark crc32(bytes without pointer field, before crc32 field)
*/
int32_t CRC_32; //32bits
public:
SrsTsPayloadPSI(SrsTsPacket* p);
virtual ~SrsTsPayloadPSI();
public:
virtual int decode(SrsStream* stream, SrsTsMessage** ppmsg);
public:
virtual int size();
virtual int encode(SrsStream* stream);
protected:
virtual int psi_size() = 0;
virtual int psi_encode(SrsStream* stream) = 0;
virtual int psi_decode(SrsStream* stream) = 0;
};
/**
* the program of PAT of PSI ts packet.
*/
class SrsTsPayloadPATProgram
{
public:
// 4B
/**
* Program_number is a 16-bit field. It specifies the program to which the program_map_PID is
* applicable. When set to 0x0000, then the following PID reference shall be the network PID. For all other cases the value
* of this field is user defined. This field shall not take any single value more than once within one version of the Program
* Association Table.
*/
int16_t number; // 16bits
/**
* reverved value, must be '1'
*/
int8_t const1_value; //3bits
/**
* program_map_PID/network_PID 13bits
* network_PID - The network_PID is a 13-bit field, which is used only in conjunction with the value of the
* program_number set to 0x0000, specifies the PID of the Transport Stream packets which shall contain the Network
* Information Table. The value of the network_PID field is defined by the user, but shall only take values as specified in
* Table 2-3. The presence of the network_PID is optional.
*/
int16_t pid; //13bits
public:
SrsTsPayloadPATProgram(int16_t n = 0, int16_t p = 0);
virtual ~SrsTsPayloadPATProgram();
public:
virtual int decode(SrsStream* stream);
public:
virtual int size();
virtual int encode(SrsStream* stream);
};
/**
* the PAT payload of PSI ts packet.
* 2.4.4.3 Program association Table, hls-mpeg-ts-iso13818-1.pdf, page 61
* The Program Association Table provides the correspondence between a program_number and the PID value of the
* Transport Stream packets which carry the program definition. The program_number is the numeric label associated with
* a program.
*/
class SrsTsPayloadPAT : public SrsTsPayloadPSI
{
public:
// 2B
/**
* This is a 16-bit field which serves as a label to identify this Transport Stream from any other
* multiplex within a network. Its value is defined by the user.
*/
u_int16_t transport_stream_id; //16bits
// 1B
/**
* reverved value, must be '1'
*/
int8_t const3_value; //2bits
/**
* This 5-bit field is the version number of the whole Program Association Table. The version number
* shall be incremented by 1 modulo 32 whenever the definition of the Program Association Table changes. When the
* current_next_indicator is set to '1', then the version_number shall be that of the currently applicable Program Association
* Table. When the current_next_indicator is set to '0', then the version_number shall be that of the next applicable Program
* Association Table.
*/
int8_t version_number; //5bits
/**
* A 1-bit indicator, which when set to '1' indicates that the Program Association Table sent is
* currently applicable. When the bit is set to '0', it indicates that the table sent is not yet applicable and shall be the next
* table to become valid.
*/
int8_t current_next_indicator; //1bit
// 1B
/**
* This 8-bit field gives the number of this section. The section_number of the first section in the
* Program Association Table shall be 0x00. It shall be incremented by 1 with each additional section in the Program
* Association Table.
*/
u_int8_t section_number; //8bits
// 1B
/**
* This 8-bit field specifies the number of the last section (that is, the section with the highest
* section_number) of the complete Program Association Table.
*/
u_int8_t last_section_number; //8bits
// multiple 4B program data.
std::vector<SrsTsPayloadPATProgram*> programs;
public:
SrsTsPayloadPAT(SrsTsPacket* p);
virtual ~SrsTsPayloadPAT();
protected:
virtual int psi_decode(SrsStream* stream);
protected:
virtual int psi_size();
virtual int psi_encode(SrsStream* stream);
};
/**
* the esinfo for PMT program.
*/
class SrsTsPayloadPMTESInfo
{
public:
// 1B
/**
* This is an 8-bit field specifying the type of program element carried within the packets with the PID
* whose value is specified by the elementary_PID. The values of stream_type are specified in Table 2-29.
*/
SrsTsStream stream_type; //8bits
// 2B
/**
* reverved value, must be '1'
*/
int8_t const1_value0; //3bits
/**
* This is a 13-bit field specifying the PID of the Transport Stream packets which carry the associated
* program element.
*/
int16_t elementary_PID; //13bits
// (2+x)B
/**
* reverved value, must be '1'
*/
int8_t const1_value1; //4bits
/**
* This is a 12-bit field, the first two bits of which shall be '00'. The remaining 10 bits specify the number
* of bytes of the descriptors of the associated program element immediately following the ES_info_length field.
*/
int16_t ES_info_length; //12bits
char* ES_info; //[ES_info_length] bytes.
public:
SrsTsPayloadPMTESInfo(SrsTsStream st = SrsTsStreamReserved, int16_t epid = 0);
virtual ~SrsTsPayloadPMTESInfo();
public:
virtual int decode(SrsStream* stream);
public:
virtual int size();
virtual int encode(SrsStream* stream);
};
/**
* the PMT payload of PSI ts packet.
* 2.4.4.8 Program Map Table, hls-mpeg-ts-iso13818-1.pdf, page 64
* The Program Map Table provides the mappings between program numbers and the program elements that comprise
* them. A single instance of such a mapping is referred to as a "program definition". The program map table is the
* complete collection of all program definitions for a Transport Stream. This table shall be transmitted in packets, the PID
* values of which are selected by the encoder. More than one PID value may be used, if desired. The table is contained in
* one or more sections with the following syntax. It may be segmented to occupy multiple sections. In each section, the
* section number field shall be set to zero. Sections are identified by the program_number field.
*/
class SrsTsPayloadPMT : public SrsTsPayloadPSI
{
public:
// 2B
/**
* program_number is a 16-bit field. It specifies the program to which the program_map_PID is
* applicable. One program definition shall be carried within only one TS_program_map_section. This implies that a
* program definition is never longer than 1016 (0x3F8). See Informative Annex C for ways to deal with the cases when
* that length is not sufficient. The program_number may be used as a designation for a broadcast channel, for example. By
* describing the different program elements belonging to a program, data from different sources (e.g. sequential events)
* can be concatenated together to form a continuous set of streams using a program_number. For examples of applications
* refer to Annex C.
*/
u_int16_t program_number; //16bits
// 1B
/**
* reverved value, must be '1'
*/
int8_t const1_value0; //2bits
/**
* This 5-bit field is the version number of the TS_program_map_section. The version number shall be
* incremented by 1 modulo 32 when a change in the information carried within the section occurs. Version number refers
* to the definition of a single program, and therefore to a single section. When the current_next_indicator is set to '1', then
* the version_number shall be that of the currently applicable TS_program_map_section. When the current_next_indicator
* is set to '0', then the version_number shall be that of the next applicable TS_program_map_section.
*/
int8_t version_number; //5bits
/**
* A 1-bit field, which when set to '1' indicates that the TS_program_map_section sent is
* currently applicable. When the bit is set to '0', it indicates that the TS_program_map_section sent is not yet applicable
* and shall be the next TS_program_map_section to become valid.
*/
int8_t current_next_indicator; //1bit
// 1B
/**
* The value of this 8-bit field shall be 0x00.
*/
u_int8_t section_number; //8bits
// 1B
/**
* The value of this 8-bit field shall be 0x00.
*/
u_int8_t last_section_number; //8bits
// 2B
/**
* reverved value, must be '1'
*/
int8_t const1_value1; //3bits
/**
* This is a 13-bit field indicating the PID of the Transport Stream packets which shall contain the PCR fields
* valid for the program specified by program_number. If no PCR is associated with a program definition for private
* streams, then this field shall take the value of 0x1FFF. Refer to the semantic definition of PCR in 2.4.3.5 and Table 2-3
* for restrictions on the choice of PCR_PID value.
*/
int16_t PCR_PID; //13bits
// 2B
int8_t const1_value2; //4bits
/**
* This is a 12-bit field, the first two bits of which shall be '00'. The remaining 10 bits specify the
* number of bytes of the descriptors immediately following the program_info_length field.
*/
u_int16_t program_info_length; //12bits
char* program_info_desc; //[program_info_length]bytes
// array of TSPMTESInfo.
std::vector<SrsTsPayloadPMTESInfo*> infos;
public:
SrsTsPayloadPMT(SrsTsPacket* p);
virtual ~SrsTsPayloadPMT();
protected:
virtual int psi_decode(SrsStream* stream);
protected:
virtual int psi_size();
virtual int psi_encode(SrsStream* stream);
};
/**
* write data from frame(header info) and buffer(data) to ts file.
* it's a simple object wrapper for utility from nginx-rtmp: SrsMpegtsWriter
*/
class SrsTSMuxer
{
private:
SrsCodecVideo vcodec;
SrsCodecAudio acodec;
private:
SrsTsContext* context;
SrsFileWriter* writer;
std::string path;
public:
SrsTSMuxer(SrsFileWriter* w, SrsTsContext* c, SrsCodecAudio ac, SrsCodecVideo vc);
virtual ~SrsTSMuxer();
public:
/**
* open the writer, donot write the PSI of ts.
* @param p a string indicates the path of ts file to mux to.
*/
virtual int open(std::string p);
/**
* when open ts, we donot write the header(PSI),
* for user may need to update the acodec to mp3 or others,
* so we use delay write PSI, when write audio or video.
* @remark for audio aac codec, for example, SRS1, it's ok to write PSI when open ts.
* @see https://github.com/ossrs/srs/issues/301
*/
virtual int update_acodec(SrsCodecAudio ac);
/**
* write an audio frame to ts,
*/
virtual int write_audio(SrsTsMessage* audio);
/**
* write a video frame to ts,
*/
virtual int write_video(SrsTsMessage* video);
/**
* close the writer.
*/
virtual void close();
public:
/**
* get the video codec of ts muxer.
*/
virtual SrsCodecVideo video_codec();
};
/**
* ts stream cache,
* use to cache ts stream.
*
* about the flv tbn problem:
* flv tbn is 1/1000, ts tbn is 1/90000,
* when timestamp convert to flv tbn, it will loose precise,
* so we must gather audio frame together, and recalc the timestamp @see SrsTsAacJitter,
* we use a aac jitter to correct the audio pts.
*/
class SrsTsCache
{
public:
// current ts message.
SrsTsMessage* audio;
SrsTsMessage* video;
public:
SrsTsCache();
virtual ~SrsTsCache();
public:
/**
* write audio to cache
*/
virtual int cache_audio(SrsAvcAacCodec* codec, int64_t dts, SrsCodecSample* sample);
/**
* write video to muxer.
*/
virtual int cache_video(SrsAvcAacCodec* codec, int64_t dts, SrsCodecSample* sample);
private:
virtual int do_cache_mp3(SrsAvcAacCodec* codec, SrsCodecSample* sample);
virtual int do_cache_aac(SrsAvcAacCodec* codec, SrsCodecSample* sample);
virtual int do_cache_avc(SrsAvcAacCodec* codec, SrsCodecSample* sample);
};
/**
* encode data to ts file.
*/
class SrsTsEncoder
{
private:
SrsFileWriter* writer;
private:
SrsAvcAacCodec* codec;
SrsCodecSample* sample;
SrsTsCache* cache;
SrsTSMuxer* muxer;
SrsTsContext* context;
public:
SrsTsEncoder();
virtual ~SrsTsEncoder();
public:
/**
* initialize the underlayer file stream.
* @param fw the writer to use for ts encoder, user must free it.
*/
virtual int initialize(SrsFileWriter* fw);
public:
/**
* write audio/video packet.
* @remark assert data is not NULL.
*/
virtual int write_audio(int64_t timestamp, char* data, int size);
virtual int write_video(int64_t timestamp, char* data, int size);
private:
virtual int flush_audio();
virtual int flush_video();
};
#endif
#endif
| [
"shilonghai@gmail.com"
] | shilonghai@gmail.com |
3c6f6b9ced50ab3d5c784782f5784e80c294ec91 | 9967320e2d4028aaad295b2101192f99d57ba7b1 | /Proyectos_en_C++/Algoritmos_y_Estructura_de_Datos_1/Unidad_10/Cajas2/CajaBotellas.cpp | 2be85c8de3d5e860358e105219a360fff4b06a76 | [] | no_license | AlfredoGonzalez76/Programacion | d2c241e1d006db13019e338f07e6941ddc5b6cef | ce9f656df97752e498cc3c405bf7bb6c397f1bce | refs/heads/main | 2023-03-01T20:08:04.520220 | 2021-02-09T23:09:16 | 2021-02-09T23:09:16 | 337,551,605 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 391 | cpp | //archivo CajaBotellas.cpp
#include "CajaBotellas.h"
#include <iostream>
using std::cout;
using std::endl;
CajaBotellas::CajaBotellas(int nro)
{
nrobotellas=nro;
}
double CajaBotellas::volumen(void)
{
return 0.85 * Caja::volumen(); //ojo no olvidar :: para invocar volumen() de Caja
}
CajaBotellas::~CajaBotellas(void)
{
//cout << "Se invoca al destructor de CajaBotellas" << endl;
}
| [
"pologonza2002@gmail.com"
] | pologonza2002@gmail.com |
14fc42f79cf62818edcbf31b18ff71bc2a78c993 | 3c6c684ae317ba74fd669f5cba9b64ea321bb586 | /Source/SIMPLib/Plugin/SIMPLibPlugin.cpp | 656cf7c2ff2e01f3520a027c17630cfe86a2064a | [
"BSD-3-Clause"
] | permissive | imikejackson/SIMPL | 6bdbe330adda6fb41d2d73993463b1aeda55c0f5 | f61686691d977c234d23320be714e11243e72231 | refs/heads/develop | 2023-07-11T19:28:10.639852 | 2023-06-28T17:44:52 | 2023-06-28T17:44:52 | 89,543,705 | 0 | 1 | null | 2017-04-28T21:36:26 | 2017-04-27T01:49:05 | C++ | UTF-8 | C++ | false | false | 4,877 | cpp | /* ============================================================================
* Copyright (c) 2009-2016 BlueQuartz Software, LLC
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of BlueQuartz Software, the US Air Force, nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The code contained herein was partially funded by the following contracts:
* United States Air Force Prime Contract FA8650-07-D-5800
* United States Air Force Prime Contract FA8650-10-D-5210
* United States Prime Contract Navy N00173-07-C-2068
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#include "SIMPLibPlugin.h"
#include "SIMPLib/SIMPLibVersion.h"
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
SIMPLibPlugin::SIMPLibPlugin()
: m_PluginName("")
, m_Version("")
, m_Vendor("")
, m_Location("")
, m_Status("")
{
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
SIMPLibPlugin::~SIMPLibPlugin() = default;
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString SIMPLibPlugin::getPluginName()
{
return m_PluginName;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SIMPLibPlugin::setPluginName(QString name)
{
m_PluginName = name;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString SIMPLibPlugin::getVersion()
{
return m_Version;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SIMPLibPlugin::setVersion(QString version)
{
m_Version = version;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString SIMPLibPlugin::getVendor()
{
return m_Vendor;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SIMPLibPlugin::setVendor(QString vendor)
{
m_Vendor = vendor;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString SIMPLibPlugin::getLocation()
{
return m_Location;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SIMPLibPlugin::setLocation(QString filePath)
{
m_Location = filePath;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString SIMPLibPlugin::getStatus()
{
return m_Status;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SIMPLibPlugin::setStatus(QString status)
{
m_Status = status;
}
| [
"mike.jackson@bluequartz.net"
] | mike.jackson@bluequartz.net |
5b89da8d05dd07d7ea62b851fb963e209e2442f4 | cc1701cadaa3b0e138e30740f98d48264e2010bd | /ash/quick_answers/ui/user_consent_view.cc | bf0fa8d4947d11afcc6455d04ccbca5927573db2 | [
"BSD-3-Clause"
] | permissive | dbuskariol-org/chromium | 35d3d7a441009c6f8961227f1f7f7d4823a4207e | e91a999f13a0bda0aff594961762668196c4d22a | refs/heads/master | 2023-05-03T10:50:11.717004 | 2020-06-26T03:33:12 | 2020-06-26T03:33:12 | 275,070,037 | 1 | 3 | BSD-3-Clause | 2020-06-26T04:04:30 | 2020-06-26T04:04:29 | null | UTF-8 | C++ | false | false | 13,985 | cc | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/quick_answers/ui/user_consent_view.h"
#include "ash/accessibility/accessibility_controller_impl.h"
#include "ash/public/cpp/vector_icons/vector_icons.h"
#include "ash/quick_answers/quick_answers_ui_controller.h"
#include "ash/quick_answers/ui/quick_answers_pre_target_handler.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_controller.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/tooltip_manager.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/coordinate_conversion.h"
namespace ash {
namespace quick_answers {
namespace {
// Main view (or common) specs.
constexpr int kMarginDip = 10;
constexpr int kLineHeightDip = 20;
constexpr int kContentSpacingDip = 8;
constexpr gfx::Insets kMainViewInsets = {16, 12, 16, 16};
constexpr gfx::Insets kContentInsets = {0, 12, 0, 0};
constexpr SkColor kMainViewBgColor = SK_ColorWHITE;
// Assistant icon.
constexpr int kAssistantIconSizeDip = 16;
// Title text.
constexpr SkColor kTitleTextColor = gfx::kGoogleGrey900;
constexpr int kTitleFontSizeDelta = 2;
// Description text.
constexpr SkColor kDescTextColor = gfx::kGoogleGrey700;
constexpr int kDescFontSizeDelta = 1;
// Buttons common.
constexpr int kButtonSpacingDip = 8;
constexpr gfx::Insets kButtonBarInsets = {8, 0, 0, 0};
constexpr gfx::Insets kButtonInsets = {6, 16, 6, 16};
constexpr int kButtonFontSizeDelta = 1;
// Manage-Settings button.
constexpr SkColor kSettingsButtonTextColor = gfx::kGoogleBlue600;
// Grant-Consent button.
constexpr SkColor kConsentButtonTextColor = gfx::kGoogleGrey200;
// Dogfood button.
constexpr int kDogfoodButtonMarginDip = 4;
constexpr int kDogfoodButtonSizeDip = 20;
constexpr SkColor kDogfoodButtonColor = gfx::kGoogleGrey500;
// Accessibility.
// TODO(siabhijeet): Move to grd after finalizing with UX.
constexpr char kA11yInfoNameTemplate[] = "New feature: %s";
// Create and return a simple label with provided specs.
std::unique_ptr<views::Label> CreateLabel(const base::string16& text,
const SkColor color,
int font_size_delta) {
auto label = std::make_unique<views::Label>(text);
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColor(color);
label->SetLineHeight(kLineHeightDip);
label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
label->SetFontList(
views::Label::GetDefaultFontList().DeriveWithSizeDelta(font_size_delta));
return label;
}
// views::LabelButton with custom line-height, color and font-list for the
// underlying label.
class CustomizedLabelButton : public views::MdTextButton {
public:
CustomizedLabelButton(views::ButtonListener* listener,
const base::string16& text,
const SkColor color)
: MdTextButton(listener, views::style::CONTEXT_BUTTON_MD) {
SetText(text);
SetCustomPadding(kButtonInsets);
SetEnabledTextColors(color);
label()->SetLineHeight(kLineHeightDip);
label()->SetFontList(views::Label::GetDefaultFontList()
.DeriveWithSizeDelta(kButtonFontSizeDelta)
.DeriveWithWeight(gfx::Font::Weight::MEDIUM));
}
// Disallow copy and assign.
CustomizedLabelButton(const CustomizedLabelButton&) = delete;
CustomizedLabelButton& operator=(const CustomizedLabelButton&) = delete;
~CustomizedLabelButton() override = default;
// views::View:
const char* GetClassName() const override { return "CustomizedLabelButton"; }
};
} // namespace
// UserConsentView -------------------------------------------------------------
UserConsentView::UserConsentView(const gfx::Rect& anchor_view_bounds,
const base::string16& intent_type,
const base::string16& intent_text,
QuickAnswersUiController* ui_controller)
: anchor_view_bounds_(anchor_view_bounds),
event_handler_(std::make_unique<QuickAnswersPreTargetHandler>(this)),
ui_controller_(ui_controller),
focus_search_(std::make_unique<QuickAnswersFocusSearch>(
this,
base::BindRepeating(&UserConsentView::GetFocusableViews,
base::Unretained(this)))) {
if (intent_type.empty() || intent_text.empty()) {
title_ = l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_CONSENT_VIEW_TITLE_TEXT);
} else {
title_ = l10n_util::GetStringFUTF16(
IDS_ASH_QUICK_ANSWERS_USER_CONSENT_VIEW_TITLE_TEXT_WITH_INTENT,
intent_type, intent_text);
}
InitLayout();
InitWidget();
// Focus should cycle to each of the buttons the view contains and back to it.
SetFocusBehavior(FocusBehavior::ALWAYS);
views::FocusRing::Install(this);
// Allow tooltips to be shown despite menu-controller owning capture.
GetWidget()->SetNativeWindowProperty(
views::TooltipManager::kGroupingPropertyKey,
reinterpret_cast<void*>(views::MenuConfig::kMenuControllerGroupingId));
// Read out user-consent notice if screen-reader is active.
GetViewAccessibility().OverrideRole(ax::mojom::Role::kAlert);
GetViewAccessibility().OverrideName(base::StringPrintf(
kA11yInfoNameTemplate, base::UTF16ToUTF8(title_).c_str()));
GetViewAccessibility().OverrideDescription(l10n_util::GetStringUTF8(
IDS_ASH_QUICK_ANSWERS_USER_CONSENT_VIEW_DESC_TEXT));
NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true);
}
UserConsentView::~UserConsentView() = default;
const char* UserConsentView::GetClassName() const {
return "UserConsentView";
}
gfx::Size UserConsentView::CalculatePreferredSize() const {
// View should match width of the anchor.
auto width = anchor_view_bounds_.width();
return gfx::Size(width, GetHeightForWidth(width));
}
void UserConsentView::OnFocus() {
// Unless screen-reader mode is enabled, transfer the focus to an actionable
// button, otherwise retain to read out its contents.
if (!ash::Shell::Get()->accessibility_controller()->spoken_feedback_enabled())
settings_button_->RequestFocus();
}
views::FocusTraversable* UserConsentView::GetPaneFocusTraversable() {
return focus_search_.get();
}
std::vector<views::View*> UserConsentView::GetFocusableViews() {
std::vector<views::View*> focusable_views;
// The view itself is not included in focus loop, unless screen-reader is on.
if (ash::Shell::Get()
->accessibility_controller()
->spoken_feedback_enabled()) {
focusable_views.push_back(this);
}
focusable_views.push_back(settings_button_);
focusable_views.push_back(consent_button_);
if (dogfood_button_)
focusable_views.push_back(dogfood_button_);
return focusable_views;
}
void UserConsentView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (sender == consent_button_) {
// When user-consent is acknowledged, QuickAnswersView will be displayed
// instead of dismissing the menu.
event_handler_->set_dismiss_anchor_menu_on_view_closed(false);
ui_controller_->OnConsentGrantedButtonPressed();
return;
}
if (sender == settings_button_) {
ui_controller_->OnManageSettingsButtonPressed();
return;
}
if (sender == dogfood_button_) {
ui_controller_->OnDogfoodButtonPressed();
return;
}
}
void UserConsentView::UpdateAnchorViewBounds(
const gfx::Rect& anchor_view_bounds) {
anchor_view_bounds_ = anchor_view_bounds;
UpdateWidgetBounds();
}
void UserConsentView::InitLayout() {
SetLayoutManager(std::make_unique<views::FillLayout>());
SetBackground(views::CreateSolidBackground(kMainViewBgColor));
// Main-view Layout.
main_view_ = AddChildView(std::make_unique<views::View>());
auto* layout =
main_view_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal, kMainViewInsets));
layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kStart);
// Assistant icon.
auto* assistant_icon =
main_view_->AddChildView(std::make_unique<views::ImageView>());
assistant_icon->SetBorder(views::CreateEmptyBorder(
(kLineHeightDip - kAssistantIconSizeDip) / 2, 0, 0, 0));
assistant_icon->SetImage(gfx::CreateVectorIcon(
kAssistantIcon, kAssistantIconSizeDip, gfx::kPlaceholderColor));
// Content.
InitContent();
// Add dogfood icon, if in dogfood.
if (chromeos::features::IsQuickAnswersDogfood())
AddDogfoodButton();
}
void UserConsentView::InitContent() {
// Layout.
content_ = main_view_->AddChildView(std::make_unique<views::View>());
content_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, kContentInsets,
kContentSpacingDip));
// Title.
content_->AddChildView(
CreateLabel(title_, kTitleTextColor, kTitleFontSizeDelta));
// Description.
auto* desc = content_->AddChildView(
CreateLabel(l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_CONSENT_VIEW_DESC_TEXT),
kDescTextColor, kDescFontSizeDelta));
desc->SetMultiLine(true);
// BoxLayout does not necessarily size the height of multi-line labels
// properly (crbug/682266). The label is thus explicitly sized to the width
// (and height) it would need to be for the UserConsentView to be the same
// width as the anchor, so its preferred size will be calculated correctly.
int desc_desired_width = anchor_view_bounds_.width() -
kMainViewInsets.width() - kContentInsets.width() -
kAssistantIconSizeDip;
desc->SizeToFit(desc_desired_width);
// Button bar.
InitButtonBar();
}
void UserConsentView::InitButtonBar() {
// Layout.
auto* button_bar = content_->AddChildView(std::make_unique<views::View>());
auto* layout =
button_bar->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal, kButtonBarInsets,
kButtonSpacingDip));
layout->set_main_axis_alignment(views::BoxLayout::MainAxisAlignment::kEnd);
// Manage-Settings button.
auto settings_button = std::make_unique<CustomizedLabelButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_CONSENT_VIEW_MANAGE_SETTINGS_BUTTON),
kSettingsButtonTextColor);
settings_button_ = button_bar->AddChildView(std::move(settings_button));
// Grant-Consent button.
auto consent_button = std::make_unique<CustomizedLabelButton>(
this,
l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_USER_CONSENT_VIEW_GRANT_CONSENT_BUTTON),
kConsentButtonTextColor);
consent_button->SetProminent(true);
consent_button_ = button_bar->AddChildView(std::move(consent_button));
}
void UserConsentView::InitWidget() {
views::Widget::InitParams params;
params.activatable = views::Widget::InitParams::Activatable::ACTIVATABLE_NO;
params.shadow_elevation = 2;
params.shadow_type = views::Widget::InitParams::ShadowType::kDrop;
params.type = views::Widget::InitParams::TYPE_POPUP;
params.z_order = ui::ZOrderLevel::kFloatingUIElement;
// Parent the widget depending on the context.
auto* active_menu_controller = views::MenuController::GetActiveInstance();
if (active_menu_controller && active_menu_controller->owner()) {
params.parent = active_menu_controller->owner()->GetNativeView();
params.child = true;
} else {
params.context = Shell::Get()->GetRootWindowForNewWindows();
}
views::Widget* widget = new views::Widget();
widget->Init(std::move(params));
widget->SetContentsView(this);
UpdateWidgetBounds();
}
void UserConsentView::AddDogfoodButton() {
auto* dogfood_view = AddChildView(std::make_unique<views::View>());
auto* layout =
dogfood_view->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical,
gfx::Insets(kDogfoodButtonMarginDip)));
layout->set_cross_axis_alignment(views::BoxLayout::CrossAxisAlignment::kEnd);
auto dogfood_button = std::make_unique<views::ImageButton>(/*listener=*/this);
dogfood_button->SetImage(
views::Button::ButtonState::STATE_NORMAL,
gfx::CreateVectorIcon(kDogfoodIcon, kDogfoodButtonSizeDip,
kDogfoodButtonColor));
dogfood_button->SetTooltipText(l10n_util::GetStringUTF16(
IDS_ASH_QUICK_ANSWERS_DOGFOOD_BUTTON_TOOLTIP_TEXT));
dogfood_button->SetFocusForPlatform();
dogfood_button_ = dogfood_view->AddChildView(std::move(dogfood_button));
}
void UserConsentView::UpdateWidgetBounds() {
const gfx::Size size = GetPreferredSize();
int x = anchor_view_bounds_.x();
int y = anchor_view_bounds_.y() - size.height() - kMarginDip;
if (y < display::Screen::GetScreen()
->GetDisplayMatching(anchor_view_bounds_)
.bounds()
.y()) {
y = anchor_view_bounds_.bottom() + kMarginDip;
}
gfx::Rect bounds({x, y}, size);
wm::ConvertRectFromScreen(GetWidget()->GetNativeWindow()->parent(), &bounds);
GetWidget()->SetBounds(bounds);
}
} // namespace quick_answers
} // namespace ash
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
5006370a67535344e242aae41fbcd5e6925f8cde | a565dc8a731c4166548d3e3bf8156c149d793162 | /PLATFORM/TI_EVM_3530/SRC/Ctlpnl/Cplmain/cplglobl.h | 26ea5b2ee615a0489f400035d08454e9ffe46316 | [] | no_license | radtek/MTI_WINCE317_BSP | eaaf3147d3de9a731a011b61f30d938dc48be5b5 | 32ea5df0f2918036f4b53a4b3aabecb113213cc6 | refs/heads/master | 2021-12-08T13:09:24.823090 | 2016-03-17T15:27:44 | 2016-03-17T15:30:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,230 | h | //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/**
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Abstract: externs for global data, CPL-specfic macros, prototypes for functions
**/
#ifndef _CPLGLOBL_H_
#define _CPLGLOBL_H_
#ifndef ARRAYSIZE
#define ARRAYSIZE(x) ((sizeof(x)) / (sizeof(x[0])))
#endif
//------------- Externs for global data (more below) ------------------------------
extern HINSTANCE g_hInst;
//------------- Data structure defns for the CPL applets -----------------------
#define MAX_TABS 5
// This structure holds the static initialization data for each tab of each CPL
typedef struct
{
int idsTitle; // RCID of title of prop-page
int iddDlg; // RCID of dlg
//DLGPROC pfnDlg; // dlg function
LPCTSTR pszDlg; // for componentization we use GetProcAddress to get our own Dlg procs!
const int* rgBoldStatics; // array of ids of controls that need to be bolded
int iNumStatics; // length of the above array
BOOL fSip; // Does this tab want the SIP up or down
LPCTSTR pszHelp; // help cmd string
}
CPLTABINFO, *PCPLTABINFO;
// For componentization, we need to translate DlgProc names to fn ptrs
// using GetProcAddress. If it's missing it means the component is not present
#define GETTABDLGPROC(iApplet, iTab) GetProcAddress(g_hInst, rgApplets[iApplet].rgptab[iTab]->pszDlg)
// This structure holds the static initialization data for each CPL.
// pfnLaunch was added to allow a specific applet to dynamically modify its
// tabs. This would be useful in situations where certain tabs may or may
// not be desired under certain run-time conditions. If it returns FALSE,
// the applet will not be displayed.
typedef struct CPLAPPLETINFO
{
LPCTSTR pszMutex; // Mutex name (must not be localized)
LPCTSTR pszLaunchCplCallback; // optional initialization callback routine name
BOOL fPwdProtect;// whether applet is to be passwd protected
int rcidIcon; // RCID of icon
int idsName; // RCID of name in CPL listview
int idsDesc; // RCID of desc in CPL listview
int idsTitle; // RCID of title of propsheet
int cctrlFlags; // classes to pass to InitCommctrlsEx or 0 if not used
const CPLTABINFO* rgptab[MAX_TABS];
}
CPLAPPLETINFO, *PCPLAPPLETINFO;
extern CPLAPPLETINFO rgApplets[];
// Applets in cplmain can optionally request to receive notifications when they
// are being launched. This notification would give them an opportunity to
// do initialization before receiving windows messages -- for example, they might
// choose to add or remove tabs to their property sheet. The notification callback
// routine must be exposed as a DLL entry point and have the following prototype.
typedef BOOL (APIENTRY *LPFNLAUNCHCPLCALLBACK)(CPLAPPLETINFO*);
class CRunningTab
{
//private:
public:
const CPLTABINFO* m_pTabData;
const PROPSHEETPAGE* m_psp;
DLGPROC m_pfnDlg; // dlg function ptr. For componentization we use GetProcAddress to get our own Dlg procs!
int m_iApplet;
int m_iTab;
HWND m_hwndSavedFocus;
HWND m_hwndSheet;
HFONT m_hfontBold;
CSipUpDown m_SipUpDown;
LPCTSTR m_pszOldPasswd; // *not* owned by this object, DO NOT free
LONG m_lParam; // Can be used by the tab's DlgProc
public:
CRunningTab(int iApplet, int iTab, PROPSHEETPAGE* psp, LPCTSTR pszOldPasswd) {
ZEROMEM(this);
m_iApplet = iApplet;
m_iTab = iTab;
m_psp = psp;
m_pTabData = rgApplets[iApplet].rgptab[iTab];
m_pfnDlg = (DLGPROC)GETTABDLGPROC(iApplet, iTab);
m_pszOldPasswd = pszOldPasswd; // *not* owned by this object, DO NOT free
m_lParam = 0; // Just initialize to 0
}
~CRunningTab() {
if(m_hfontBold) DeleteObject(m_hfontBold);
}
};
// SIP fn ptr types
typedef BOOL (WINAPI* LPFNSIP)(SIPINFO*);
typedef DWORD (WINAPI* LPFNSIPSTATUS)();
//------------- Externs for global data ------------------------------
extern CPLAPPLETINFO rgApplets[];
extern HINSTANCE g_hInst;
extern HWND g_hwndWelcome;
extern BOOL g_fNoDrag;
extern BOOL g_fFullScreen;
extern BOOL g_fRecenterForSIP;
extern BOOL g_fRaiseLowerSIP;
extern HINSTANCE g_hinstCoreDll;
extern LPFNSIP g_pSipGetInfo;
extern LPFNSIP g_pSipSetInfo;
//------------- Defines useful only in these CPLs --------------------
// Debug zones
#define ZONE_ERROR DEBUGZONE(0)
#define ZONE_WARNING DEBUGZONE(1)
#define ZONE_MAIN DEBUGZONE(2)
#define ZONE_UTILS DEBUGZONE(3)
#define ZONE_REG DEBUGZONE(4)
#define ZONE_DATETIME DEBUGZONE(5)
#define ZONE_NETWORK DEBUGZONE(8)
#define ZONE_COMM DEBUGZONE(9)
#define ZONE_KEYBD DEBUGZONE(10)
#define ZONE_POWER DEBUGZONE(11)
#define ZONE_SYSTEM DEBUGZONE(12)
#define ZONE_STYLUS DEBUGZONE(13)
#define ZONE_SOUNDS DEBUGZONE(14)
#define ZONE_MSGS DEBUGZONE(15)
#define ZONE_SCREEN DEBUGZONE(16)
#define ZONE_REMOVE DEBUGZONE(17)
//------------- Function prototypes ------------------------------
//
// from CPLMAIN.CPP
//
int GetCplInfo(int iApplet, NEWCPLINFO *pInfo);
LONG LaunchCpl(int iApplet, int iTab);
int CALLBACK CplSheetCallback(HWND hwndDlg,UINT uMsg, LPARAM lParam);
BOOL CALLBACK CplPageProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
//
// from CPLUTILS.CPP
//
void LoadRegGlobals(void);
HANDLE CheckPrevInstance(LPCTSTR pszMutexName, LPCTSTR pszTitle, BOOL fPwd);
void SetDeviceDependentText(HWND hDlg, int idc, int idsFmt);
BOOL SetWordCompletion(BOOL fOn);
BOOL CenterWindowSIPAware(HWND hwnd, BOOL fInitial=TRUE);
void DrawBitmapOnDc(DRAWITEMSTRUCT *lpdis, int nBitmapId, BOOL fDisabled);
void DrawCPLButton(DRAWITEMSTRUCT* lpdis, int idbBitmap);
LPTSTR PromptForPasswd(HWND hParent);
HFONT CreateBoldFont(HWND hDlg);
void SetTextWithEllipsis(HWND hwnd, LPCTSTR lpszText);
void LoadCB(HWND hwndCB, const COMBODATA rgCBData[], BOOL fData=TRUE);
HBRUSH WINAPI LoadDIBitmapBrush(LPCTSTR szFileName);
void InitImageList(HIMAGELIST& hImgList, BOOL fMini, int rgIcons[], int iNumIcons);
BOOL AygInitDialog( HWND hwnd, DWORD dwFlags );
BOOL AygAddSipprefControl( HWND hwnd );
BOOL LoadAygshellLibrary();
BOOL FreeAygshellLibrary();
// from OWNER.CPP
void GetOwnerInfo(OWNER_PROFILE* pProfile, OWNER_NOTES* pNotes);
// from UNLOADN.CPP
extern "C" int APIENTRY UninstallApplication(HINSTANCE hinst, HWND hwndParent, LPCTSTR pszApp);
//------------- Const data prototypes ------------------------------
//
// from CPLTABL.CPP
//
extern const CPLTABINFO CommRasTab;
extern const CPLTABINFO SndSchemeTab;
//extern const CPLTABINFO ColSchemeTab;
extern const LPCTSTR pszSaveColSchemeHelp;
#endif //_CPLGLOBL_H_
| [
"ruslan.sirota@micronet-inc.com"
] | ruslan.sirota@micronet-inc.com |
b36ba4a4f6809a200f447b1892ad3eb6b6223b9a | a1fbf16243026331187b6df903ed4f69e5e8c110 | /cs/engine/xrGame/game_cl_single.h | 23eef71424fd3c351220042c9a83e7b200cadd42 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | OpenXRay/xray-15 | ca0031cf1893616e0c9795c670d5d9f57ca9beff | 1390dfb08ed20997d7e8c95147ea8e8cb71f5e86 | refs/heads/xd_dev | 2023-07-17T23:42:14.693841 | 2021-09-01T23:25:34 | 2021-09-01T23:25:34 | 23,224,089 | 64 | 23 | NOASSERTION | 2019-04-03T17:50:18 | 2014-08-22T12:09:41 | C++ | UTF-8 | C++ | false | false | 1,199 | h | #pragma once
#include "game_cl_base.h"
class game_cl_Single :public game_cl_GameState
{
typedef game_cl_GameState inherited;
public :
game_cl_Single ();
virtual CUIGameCustom* createGameUI ();
virtual char* getTeamSection (int Team);
virtual bool IsServerControlHits () {return true;};
virtual ALife::_TIME_ID GetStartGameTime ();
virtual ALife::_TIME_ID GetGameTime ();
virtual float GetGameTimeFactor ();
virtual void SetGameTimeFactor (const float fTimeFactor);
virtual ALife::_TIME_ID GetEnvironmentGameTime ();
virtual float GetEnvironmentGameTimeFactor();
virtual void SetEnvironmentGameTimeFactor(const float fTimeFactor);
void OnDifficultyChanged ();
};
// game difficulty
enum ESingleGameDifficulty{
egdNovice = 0,
egdStalker = 1,
egdVeteran = 2,
egdMaster = 3,
egdCount,
egd_force_u32 = u32(-1)
};
extern ESingleGameDifficulty g_SingleGameDifficulty;
xr_token difficulty_type_token [ ];
typedef enum_exporter<ESingleGameDifficulty> CScriptGameDifficulty;
add_to_type_list(CScriptGameDifficulty)
#undef script_type_list
#define script_type_list save_type_list(CScriptGameDifficulty)
| [
"paul-kv@yandex.ru"
] | paul-kv@yandex.ru |
206fd580c9421d56c4ed2cf0bbe54ff97708f524 | 400ff661684148cbb6aa99f4ebbc82bc551356d9 | /window/MFC/file-manager-demo/MFCApplication15/MyDirListView.cpp | 0df5dab8018f3f784f186ecae83181235afe73d4 | [] | no_license | csw201710/demo | 32d71f333dc7f78fab0e2ab53f6a7e051847eea3 | 386a56961e8099b632115015cbeec599765ead01 | refs/heads/master | 2021-08-26T08:03:49.055496 | 2021-08-18T11:22:45 | 2021-08-18T11:22:45 | 171,476,054 | 7 | 11 | null | null | null | null | GB18030 | C++ | false | false | 3,603 | cpp | // MyDirListView.cpp : 实现文件
//
#include "stdafx.h"
#include "MFCApplication15.h"
#include "MyDirListView.h"
// CMyDirListView
IMPLEMENT_DYNCREATE(CMyDirListView, CListView)
CMyDirListView::CMyDirListView()
{
}
CMyDirListView::~CMyDirListView()
{
}
BEGIN_MESSAGE_MAP(CMyDirListView, CListView)
ON_WM_CREATE()
ON_WM_SIZE()
ON_MESSAGE(WM_LISTINSERTDATA, &CMyDirListView::OnListinsertdata)
END_MESSAGE_MAP()
// CMyDirListView 诊断
#ifdef _DEBUG
void CMyDirListView::AssertValid() const
{
CListView::AssertValid();
}
#ifndef _WIN32_WCE
void CMyDirListView::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
#endif
#endif //_DEBUG
void CMyDirListView::SelectListHeader(int a)
{
GetListCtrl().DeleteAllItems();
while (GetListCtrl().GetHeaderCtrl() && GetListCtrl().GetHeaderCtrl()->GetItemCount() > 0) {
GetListCtrl().DeleteColumn(0);
}
if (a == 1)
{
GetListCtrl().InsertColumn(0, "名称", LVCFMT_LEFT, 140);
GetListCtrl().InsertColumn(1, "类型", LVCFMT_LEFT, 100);
GetListCtrl().InsertColumn(2, "大小", LVCFMT_RIGHT, 100);
GetListCtrl().InsertColumn(3, "可用空间", LVCFMT_RIGHT, 100);
}
else
{
GetListCtrl().InsertColumn(0, "名称", LVCFMT_LEFT, 150);
GetListCtrl().InsertColumn(1, "类型", LVCFMT_LEFT, 100);
GetListCtrl().InsertColumn(2, "大小", LVCFMT_RIGHT, 100);
GetListCtrl().InsertColumn(3, "修改时间", LVCFMT_RIGHT, 200);
GetListCtrl().InsertColumn(4, "所在目录", LVCFMT_LEFT, 250);
}
}
int CMyDirListView::InsertListData(int type, char * path)
{
SelectListHeader(type);
int nItem = GetListCtrl().InsertItem(GetListCtrl().GetItemCount(),path);
if (nItem == -1) return FALSE;
GetListCtrl().SetItemText(nItem, 0, "0");
if (type == 1)
{
GetListCtrl().SetItemText(nItem, 1, "1");
GetListCtrl().SetItemText(nItem, 2, "2");
GetListCtrl().SetItemText(nItem, 3, "3");
}
else
{
GetListCtrl().SetItemText(nItem, 1, "1");
GetListCtrl().SetItemText(nItem, 2, "2");
GetListCtrl().SetItemText(nItem, 3, "3");
GetListCtrl().SetItemText(nItem, 4, "4");
}
return 0;
}
// CMyDirListView 消息处理程序
int CMyDirListView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CListView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
int nImage = 0;
m_TreeImageList.Create(16, 16, ILC_COLOR8 | ILC_MASK, 6, 6);
m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_COMPUTER));
m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME));
m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_DIR_CLOSE));
m_TreeImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON_DIR_OPEN));
GetListCtrl().ModifyStyle(0, LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_EDITLABELS);
//GetListCtrl().SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
GetListCtrl().SetImageList(&m_TreeImageList, LVSIL_SMALL);
//GetListCtrl().InsertColumn(0, "名称", LVCFMT_LEFT, 140);
//GetListCtrl().InsertColumn(1, "类型", LVCFMT_LEFT, 170);
//GetListCtrl().InsertColumn(2, "大小", LVCFMT_RIGHT, 100);
//GetListCtrl().InsertColumn(3, "可用空间", LVCFMT_RIGHT, 100);
//InsertListData(0, "");
SelectListHeader(1);
return 0;
}
void CMyDirListView::OnSize(UINT nType, int cx, int cy)
{
CListView::OnSize(nType, cx, cy);
// TODO: 在此处添加消息处理程序代码
}
afx_msg LRESULT CMyDirListView::OnListinsertdata(WPARAM wParam, LPARAM lParam)
{
char * path = (char*)wParam;
return 0;
}
| [
"work@qq.com"
] | work@qq.com |
7f8c0670d66a6f4660216946eebb9fcf8c964b38 | befaf0dfc5880d18f42e1fa7e39e27f8d2f8dde9 | /SDK/SCUM_Pizza_classes.hpp | 7350881b2c083affdf31546c059de2fb50148fb7 | [] | no_license | cpkt9762/SCUM-SDK | 0b59c99748a9e131eb37e5e3d3b95ebc893d7024 | c0dbd67e10a288086120cde4f44d60eb12e12273 | refs/heads/master | 2020-03-28T00:04:48.016948 | 2018-09-04T13:32:38 | 2018-09-04T13:32:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 613 | hpp | #pragma once
// SCUM (0.1.17.8320) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "SCUM_Pizza_structs.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass Pizza.Pizza_C
// 0x0000 (0x0870 - 0x0870)
class APizza_C : public AFoodItem
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindObject<UClass>("BlueprintGeneratedClass Pizza.Pizza_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"igromanru@yahoo.de"
] | igromanru@yahoo.de |
9019f40777ec12da04481faaa2edf4dd73b62bbc | fdb963647dc9317947943874a51f58c1240f994c | /project/Framework/Effect/RendererEffect.cpp | 8fe4b8bc2942599d5f8fc2986e46022e848694fa | [
"MIT"
] | permissive | SomeTake/HF21MisotenH206 | 0f2e5e92a71ef4c89b43c4ebd8d3a0bf632f03b4 | 821d8d4ec8b40c236ac6b0e6e7ba5f89c06b950d | refs/heads/master | 2020-07-25T07:44:09.728095 | 2020-01-17T10:15:03 | 2020-01-17T10:15:03 | 208,212,885 | 0 | 2 | MIT | 2020-01-17T08:00:14 | 2019-09-13T07:02:16 | C++ | SHIFT_JIS | C++ | false | false | 3,187 | cpp | //=====================================
//
//描画エフェクト処理[RendererEffect.cpp]
//Author:GP12A332 21 立花雄太
//
//=====================================
#include "RendererEffect.h"
/**************************************
static変数
***************************************/
D3DXMATRIX RendererEffect::mtxView;
D3DXMATRIX RendererEffect::mtxProjection;
std::vector<D3DXVECTOR4> RendererEffect::lightDir;
std::vector<D3DCOLORVALUE> RendererEffect::lightDiffuse;
std::vector<D3DCOLORVALUE> RendererEffect::lightAmbient;
std::vector<D3DCOLORVALUE> RendererEffect::lightSpecular;
/*************************************
ビュー行列設定処理
***************************************/
void RendererEffect::SetView(const D3DXMATRIX & viewMatrix)
{
mtxView = viewMatrix;
}
/*************************************
プロジェクション行列設定処理
***************************************/
void RendererEffect::SetProjection(const D3DXMATRIX & projectionMatrix)
{
mtxProjection = projectionMatrix;
}
/*************************************
ライト情報設定処理
***************************************/
void RendererEffect::SetLight(unsigned index, const D3DLIGHT9 & light)
{
if (lightDir.size() <= index)
{
lightDir.resize(index + 1);
lightDiffuse.resize(index + 1);
lightAmbient.resize(index + 1);
lightSpecular.resize(index + 1);
}
lightDir[index] = D3DXVECTOR4(light.Direction, 0.0f);
lightDiffuse[index] = light.Diffuse;
lightAmbient[index] = light.Ambient;
lightSpecular[index] = light.Specular;
}
/**************************************
マテリアル情報設定処理
***************************************/
void RendererEffect::SetMaterial(const D3DMATERIAL9 & material)
{
effect->SetFloatArray(hMatDiffuse, (float*)&material.Diffuse, 4);
effect->SetFloatArray(hMatAmbient, (float*)&material.Ambient, 4);
effect->SetFloatArray(hMatSpecular, (float*)&material.Specular, 4);
}
/**************************************
変更反映処理
***************************************/
void RendererEffect::Commit()
{
effect->SetMatrix(hView, &mtxView);
effect->SetMatrix(hProjection, &mtxProjection);
effect->SetVectorArray(hLightDirection, &lightDir[0], lightDir.size());
effect->SetVectorArray(hLightDiffuse, (D3DXVECTOR4*)&lightDiffuse[0], lightDiffuse.size());
effect->SetVectorArray(hLightAmbient, (D3DXVECTOR4*)&lightAmbient[0], lightAmbient.size());
effect->SetVectorArray(hLightSpecular, (D3DXVECTOR4*)&lightSpecular[0], lightSpecular.size());
effect->CommitChanges();
}
/**************************************
描画開始宣言
***************************************/
void RendererEffect::Begin()
{
Commit();
effect->Begin(0, 0);
}
/**************************************
パス開始宣言
***************************************/
void RendererEffect::BeginPass(DWORD pass)
{
effect->BeginPass(pass);
}
/**************************************
パス終了宣言
***************************************/
void RendererEffect::EndPass()
{
effect->EndPass();
}
/**************************************
描画終了宣言
***************************************/
void RendererEffect::End()
{
effect->End();
}
| [
"yuta.tachibana0310@gmail.com"
] | yuta.tachibana0310@gmail.com |
5d9fceb0f4e550aa06436e9289c0b1dc6d497d63 | 6ced41da926682548df646099662e79d7a6022c5 | /aws-cpp-sdk-apprunner/source/model/CreateVpcConnectorRequest.cpp | 8e5cca44db13945e59e306373c8951189a9af05e | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | irods/aws-sdk-cpp | 139104843de529f615defa4f6b8e20bc95a6be05 | 2c7fb1a048c96713a28b730e1f48096bd231e932 | refs/heads/main | 2023-07-25T12:12:04.363757 | 2022-08-26T15:33:31 | 2022-08-26T15:33:31 | 141,315,346 | 0 | 1 | Apache-2.0 | 2022-08-26T17:45:09 | 2018-07-17T16:24:06 | C++ | UTF-8 | C++ | false | false | 2,094 | cpp | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/apprunner/model/CreateVpcConnectorRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::AppRunner::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
CreateVpcConnectorRequest::CreateVpcConnectorRequest() :
m_vpcConnectorNameHasBeenSet(false),
m_subnetsHasBeenSet(false),
m_securityGroupsHasBeenSet(false),
m_tagsHasBeenSet(false)
{
}
Aws::String CreateVpcConnectorRequest::SerializePayload() const
{
JsonValue payload;
if(m_vpcConnectorNameHasBeenSet)
{
payload.WithString("VpcConnectorName", m_vpcConnectorName);
}
if(m_subnetsHasBeenSet)
{
Array<JsonValue> subnetsJsonList(m_subnets.size());
for(unsigned subnetsIndex = 0; subnetsIndex < subnetsJsonList.GetLength(); ++subnetsIndex)
{
subnetsJsonList[subnetsIndex].AsString(m_subnets[subnetsIndex]);
}
payload.WithArray("Subnets", std::move(subnetsJsonList));
}
if(m_securityGroupsHasBeenSet)
{
Array<JsonValue> securityGroupsJsonList(m_securityGroups.size());
for(unsigned securityGroupsIndex = 0; securityGroupsIndex < securityGroupsJsonList.GetLength(); ++securityGroupsIndex)
{
securityGroupsJsonList[securityGroupsIndex].AsString(m_securityGroups[securityGroupsIndex]);
}
payload.WithArray("SecurityGroups", std::move(securityGroupsJsonList));
}
if(m_tagsHasBeenSet)
{
Array<JsonValue> tagsJsonList(m_tags.size());
for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
{
tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize());
}
payload.WithArray("Tags", std::move(tagsJsonList));
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection CreateVpcConnectorRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AppRunner.CreateVpcConnector"));
return headers;
}
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
030707ea2d92f4f80d8286e3b98170e269111c9d | 03aac7ce536cb55ac6e4423cd02e5ea7990b6906 | /CleverManagerV3/common/sqlcom/sqlexportdlg.cpp | 55ba68bb84f260238b63e1a1ac69875de68e3809 | [] | no_license | tbbug/CleverManagerV3 | 32f359546346efdef070e60068cb498f38baae37 | 26f000939164b6defe66736394328200c77bf417 | refs/heads/master | 2023-03-16T02:06:48.681239 | 2020-05-15T03:25:56 | 2020-05-15T03:25:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,774 | cpp | /*
* log_exportdlg.cpp
* 导出窗口
*
* Created on: 2017年10月11日
* Author: Lzy
*/
#include "sqlexportdlg.h"
#include "ui_sqlexportdlg.h"
SqlExportDlg::SqlExportDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::SqlExportDlg)
{
ui->setupUi(this);
groupBox_background_icon(this);
this->setWindowTitle(tr("日志导出"));
mExportThread = new Excel_SaveThread(this);
timer = new QTimer(this);
connect( timer, SIGNAL(timeout()),this, SLOT(timeoutDone()));
}
SqlExportDlg::~SqlExportDlg()
{
delete ui;
}
void SqlExportDlg::init(const QString &title, QList<QStringList> &list)
{
mList = list;
QString fn = title + tr("导出");
ui->progressBar->setValue(0);
ui->titleLab->setText(fn);
ui->fileEdit->setText(fn);
}
/**
* @brief 路径选择
*/
void SqlExportDlg::on_pushButton_clicked()
{
QFileDialog dlg(this,tr("路径选择"));
dlg.setFileMode(QFileDialog::DirectoryOnly);
dlg.setDirectory("E:");
if(dlg.exec() == QDialog::Accepted) {
QString fn = dlg.selectedFiles().at(0);
if(fn.right(1) != "/") fn += "/";
ui->pathEdit->setText(fn);
}
}
/**
* @brief 检查输入
*/
bool SqlExportDlg::checkInput()
{
QString str = ui->pathEdit->text();
if(str.isEmpty()) {
CriticalMsgBox box(this, tr("导出路径不能为空!"));
return false;
}
str = ui->fileEdit->text();
if(str.isEmpty()) {
CriticalMsgBox box(this, tr("导出文件名不能为空!"));
return false;
}
str = ui->pathEdit->text() + ui->fileEdit->text() +".xlsx";
QFile file(str);
if (file.exists()){
CriticalMsgBox box(this, str + tr("\n文件已存在!!"));
return false;
}
ui->exportBtn->setEnabled(false);
ui->quitBtn->setEnabled(false);
ui->progressBar->setValue(1);
return true;
}
/**
* @brief 导出完成
*/
void SqlExportDlg::exportDone()
{
ui->exportBtn->setEnabled(true);
ui->quitBtn->setEnabled(true);
InfoMsgBox box(this, tr("\n导出完成!!\n"));
}
void SqlExportDlg::timeoutDone()
{
int progress = mExportThread->getProgress();
if(progress < 100)
ui->progressBar->setValue(progress);
else {
ui->progressBar->setValue(progress);
timer->stop();
exportDone();
}
}
void SqlExportDlg::on_exportBtn_clicked()
{
bool ret = checkInput();
if(ret) {
timer->start(100);
QString fn = ui->pathEdit->text() + ui->fileEdit->text();
mExportThread->saveData(fn, mList);
}
}
void SqlExportDlg::on_quitBtn_clicked()
{
if(timer->isActive()) {
InfoMsgBox box(this, tr("\n导出还没有完成,还不能关闭!!\n"));
} else {
this->close();
}
}
| [
"luozhiyong131@qq.com"
] | luozhiyong131@qq.com |
c621045420ad4751684ead8ac3413e3ee7bb770f | 747e2d79f77c64094de69df9128a4943c170d171 | /StageServer/Protocol/FromServer.cpp | 6472fafa0f99cd08305b60816c85c836ec828013 | [
"MIT"
] | permissive | Teles1/LuniaAsio | 8854b6d59e5b2622dec8eb0d74c4e4a6cafc76a1 | 62e404442cdb6e5523fc6e7a5b0f64a4471180ed | refs/heads/main | 2023-06-14T00:39:11.740469 | 2021-07-05T23:29:44 | 2021-07-05T23:29:44 | 383,286,395 | 0 | 0 | MIT | 2021-07-05T23:29:45 | 2021-07-05T23:26:46 | C++ | WINDOWS-1252 | C++ | false | false | 279,942 | cpp | #include <StageServer/Protocol/FromServer.h>
namespace Lunia
{
namespace XRated
{
namespace StageServer
{
namespace Protocol
{
namespace FromServer {
// Error
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* Error::TypeName = L"Error";
const HashType Error::TypeHash = StringUtil::Hash(Error::TypeName);
void Error::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"errorcode", errorcode);
out.Write(L"errorstring", errorstring);
}
void Error::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"errorcode", errorcode);
in.Read(L"errorstring", errorstring);
}
//////////////////////////////////////////////////////////////////////////////////
///Error //
// Way
// ////////////////////////////////////////////////////////////////////////////////////
const wchar_t* Way::TypeName = L"Way";
const HashType Way::TypeHash = StringUtil::Hash(Way::TypeName);
void Way::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"EncryptKey", EncryptKey);
}
void Way::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"EncryptKey", EncryptKey);
}
////////////////////////////////////////////////////////////////////////////////////
///Way //
// Alive
// ////////////////////////////////////////////////////////////////////////////////////
const wchar_t* Alive::TypeName = L"Alive";
const HashType Alive::TypeHash = StringUtil::Hash(Alive::TypeName);
void Alive::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"EncryptKey", EncryptKey);
out.Write(L"RequestTime", RequestTime);
}
void Alive::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"EncryptKey", EncryptKey);
in.Read(L"RequestTime", RequestTime);
}
////////////////////////////////////////////////////////////////////////////////////
///Alive //
// stage
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* Stage::TypeName = L"Stage";
const HashType Stage::TypeHash = StringUtil::Hash(Stage::TypeName);
void Stage::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"charactername", charactername);
out.Write(L"targetStage", targetStage);
}
void Stage::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"charactername", charactername);
in.Read(L"targetStage", targetStage);
}
//////////////////////////////////////////////////////////////////////////////////
///Stage //
// Floor
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* Floor::TypeName = L"Floor";
const HashType Floor::TypeHash = StringUtil::Hash(Floor::TypeName);
void Floor::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"floor", floor);
}
void Floor::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"floor", floor);
}
//////////////////////////////////////////////////////////////////////////////////
///Floor //
// Granted
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* Granted::TypeName = L"Granted";
const HashType Granted::TypeHash =
StringUtil::Hash(Granted::TypeName);
void Granted::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"charactername", charactername);
out.Write(L"targetStage", targetStage);
}
void Granted::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"charactername", charactername);
in.Read(L"targetStage", targetStage);
}
////////////////////////////////////////////////////////////////////////////////
///Granted //
// CharacterInfo
// //////////////////////////////////////////////////////////////////////////
const wchar_t* CharacterInfo::TypeName = L"CharacterInfo";
const HashType CharacterInfo::TypeHash =
StringUtil::Hash(CharacterInfo::TypeName);
void CharacterInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"classtype", classtype);
out.Write(L"level", level);
out.Write(L"xp", xp);
out.Write(L"pvpLevel", pvpLevel);
out.Write(L"pvpXp", pvpXp);
out.Write(L"warLevel", warLevel);
out.Write(L"warXp", warXp);
out.Write(L"storedLevel", storedLevel);
out.Write(L"rebirthCount", rebirthCount);
out.Write(L"money", money);
out.Write(L"bankMoney", bankMoney);
out.Write(L"life", life);
out.Write(L"skillpoint", skillpoint);
out.Write(L"addedSkillPointPlus", addedSkillPointPlus);
out.Write(L"storedSkillPoint", storedSkillPoint);
out.Write(L"ladderPoint", ladderPoint);
out.Write(L"ladderMatchCount", ladderMatchCount);
out.Write(L"ladderWinCount", ladderWinCount);
out.Write(L"ladderLoseCount", ladderLoseCount);
out.Write(L"achievementScore", achievementScore); // 3.1 by Robotex
out.Write(L"IsSpectator", IsSpectator);
}
void CharacterInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"classtype", classtype);
in.Read(L"level", level);
in.Read(L"xp", xp);
in.Read(L"pvpLevel", pvpLevel);
in.Read(L"pvpXp", pvpXp);
in.Read(L"warLevel", warLevel);
in.Read(L"warXp", warXp);
in.Read(L"storedLevel", storedLevel);
in.Read(L"rebirthCount", rebirthCount);
in.Read(L"money", money);
in.Read(L"bankMoney", bankMoney);
in.Read(L"life", life);
in.Read(L"skillpoint", skillpoint);
in.Read(L"addedSkillPointPlus", addedSkillPointPlus);
in.Read(L"storedSkillPoint", storedSkillPoint);
in.Read(L"ladderPoint", ladderPoint);
in.Read(L"ladderMatchCount", ladderMatchCount);
in.Read(L"ladderWinCount", ladderWinCount);
in.Read(L"ladderLoseCount", ladderLoseCount);
in.Read(L"achievementScore", achievementScore); // 3.1 by Robotex
in.Read(L"IsSpectator", IsSpectator);
}
//////////////////////////////////////////////////////////////////////////
///CharacterInfo //
// BonusLife
// //////////////////////////////////////////////////////////////////////////
const wchar_t* BonusLife::TypeName = L"BonusLife";
const HashType BonusLife::TypeHash =
StringUtil::Hash(BonusLife::TypeName);
void BonusLife::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"bonusLife", bonusLife);
out.Write(L"usableBonusLife", usableBonusLife);
}
void BonusLife::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"bonusLife", bonusLife);
in.Read(L"usableBonusLife", usableBonusLife);
}
//////////////////////////////////////////////////////////////////////////
///BonusLife //
// ListQuickSlot
// //////////////////////////////////////////////////////////////////////////
const wchar_t* ListQuickSlot::TypeName = L"ListQuickSlot";
const HashType ListQuickSlot::TypeHash =
StringUtil::Hash(ListQuickSlot::TypeName);
void ListQuickSlot::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"quickslotlist", quickslotlist);
}
void ListQuickSlot::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"quickslotlist", quickslotlist);
}
//////////////////////////////////////////////////////////////////////////
///ListQuickSlot //
// ListSkill
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* ListSkill::TypeName = L"ListSkill";
const HashType ListSkill::TypeHash =
StringUtil::Hash(ListSkill::TypeName);
void ListSkill::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"listskill", listskill);
};
void ListSkill::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"listskill", listskill);
}
//////////////////////////////////////////////////////////////////////////////
///ListSkill //
// ListSkillLicenses
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* ListSkillLicenses::TypeName = L"ListSkillLicenses";
const HashType ListSkillLicenses::TypeHash =
StringUtil::Hash(ListSkillLicenses::TypeName);
void ListSkillLicenses::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"listSkillLicenses", listSkillLicenses);
};
void ListSkillLicenses::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"listSkillLicenses", listSkillLicenses);
}
//////////////////////////////////////////////////////////////////////////////
///ListSkillLicenses //
// ListItem
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* ListItem::TypeName = L"ListItem";
const HashType ListItem::TypeHash =
StringUtil::Hash(ListItem::TypeName);
void ListItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"listitem", listitem);
};
void ListItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"listitem", listitem);
}
///////////////////////////////////////////////////////////////////////////////
///ListItem //
// LoadEnd
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* LoadEnd::TypeName = L"LoadEnd";
const HashType LoadEnd::TypeHash =
StringUtil::Hash(LoadEnd::TypeName);
void LoadEnd::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"charName", charName);
out.Write(L"progress", progress);
};
void LoadEnd::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"charName", charName);
in.Read(L"progress", progress);
}
////////////////////////////////////////////////////////////////////////////////
///LoadEnd //
// Chat
// ///////////////////////////////////////////////////////////////////////////////////
const wchar_t* Chat::TypeName = L"Chat";
const HashType Chat::TypeHash = StringUtil::Hash(Chat::TypeName);
void Chat::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.WriteEnum(L"chattype", chattype);
out.Write(L"message", message);
}
void Chat::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.ReadEnum(L"chattype", chattype);
in.Read(L"message", message);
}
///////////////////////////////////////////////////////////////////////////////////
///Chat //
// SpectatorChat
// ///////////////////////////////////////////////////////////////////////////////////
const wchar_t* SpectatorChat::TypeName = L"SpectatorChat";
const HashType SpectatorChat::TypeHash =
StringUtil::Hash(SpectatorChat::TypeName);
void SpectatorChat::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"characterName", characterName);
out.WriteEnum(L"chattype", chattype);
out.Write(L"message", message);
}
void SpectatorChat::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"characterName", characterName);
in.ReadEnum(L"chattype", chattype);
in.Read(L"message", message);
}
///////////////////////////////////////////////////////////////////////////////////
///SpectatorChat //
// Voice
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* Voice::TypeName = L"Voice";
const HashType Voice::TypeHash = StringUtil::Hash(Voice::TypeName);
void Voice::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"chattype", chattype);
out.Write(L"messageid", messageid);
}
void Voice::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"chattype", chattype);
in.Read(L"messageid", messageid);
}
//////////////////////////////////////////////////////////////////////////////////
///Voice //
// StageMove
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* StageMove::TypeName = L"StageMove";
const HashType StageMove::TypeHash =
StringUtil::Hash(StageMove::TypeName);
void StageMove::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serverAddress", serverAddress);
out.Write(L"portNumber", portNumber);
out.Write(L"keyCode", keyCode);
}
void StageMove::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serverAddress", serverAddress);
in.Read(L"portNumber", portNumber);
in.Read(L"keyCode", keyCode);
}
//////////////////////////////////////////////////////////////////////////////
///StageMove //
// Cast
// ///////////////////////////////////////////////////////////////////////////////////
const wchar_t* Cast::TypeName = L"Cast";
const HashType Cast::TypeHash = StringUtil::Hash(Cast::TypeName);
void Cast::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"result", result);
out.Write(L"playerserial", playerserial);
out.Write(L"skillgroupid", skillgroupid);
out.Write(L"skilllevel", skilllevel);
}
void Cast::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"result", result);
in.Read(L"playerserial", playerserial);
in.Read(L"skillgroupid", skillgroupid);
in.Read(L"skilllevel", skilllevel);
}
///////////////////////////////////////////////////////////////////////////////////
///Cast //
// SetSkillLevel
// //////////////////////////////////////////////////////////////////////////
const wchar_t* SetSkillLevel::TypeName = L"SetSkillLevel";
const HashType SetSkillLevel::TypeHash =
StringUtil::Hash(SetSkillLevel::TypeName);
void SetSkillLevel::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"skillgoupid", skillgroupid);
out.Write(L"skilllevel", skilllevel);
out.Write(L"LeftSkillPoint", LeftSkillPoint);
}
void SetSkillLevel::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"skillgoupid", skillgroupid);
in.Read(L"skilllevel", skilllevel);
in.Read(L"LeftSkillPoint", LeftSkillPoint);
}
//////////////////////////////////////////////////////////////////////////
///SetSkillLevel //
// CreatePlayer
// ///////////////////////////////////////////////////////////////////////////
void CreatePlayer::Equipment::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(L"CreatePlayer::Equipment");
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
}
void CreatePlayer::Equipment::Deserialize(Serializer::IStreamReader& in) {
in.Begin(L"CreatePlayer::Equipment");
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
}
const wchar_t* CreatePlayer::TypeName = L"CreatePlayer";
const HashType CreatePlayer::TypeHash =
StringUtil::Hash(CreatePlayer::TypeName);
void CreatePlayer::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.WriteEnum(L"classtype", classtype);
out.Write(L"charactername", charactername);
out.Write(L"level", level);
out.Write(L"pvpLevel", pvpLevel);
out.Write(L"warLevel", warLevel);
out.Write(L"storedLevel", storedLevel);
out.Write(L"rebirthCount", rebirthCount);
out.Write(L"ladderPoint", ladderPoint);
out.Write(L"ladderMatchCount", ladderMatchCount);
out.Write(L"ladderWinCount", ladderWinCount);
out.Write(L"ladderLoseCount", ladderLoseCount);
out.Write(L"achievementScore", achievementScore); // 3.1 by Robotex
out.Write(L"addedSkillPointByRebirth", addedSkillPointByRebirth);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"hp", hp);
out.Write(L"team", team);
out.Write(L"Equipments", Equipments);
out.Write(L"PassiveItems", PassiveItems);
out.Write(L"stateflags", stateflags);
out.Write(L"shopping", shopping);
out.Write(L"stageLicenses", stageLicenses);
out.Write(L"lives", lives);
out.Write(L"bonusLife", bonusLife);
out.Write(L"CharacterStateFlags", static_cast<int>(CharacterStateFlags));
out.Write(L"lastRebirthDateTime", lastRebirthDateTime);
out.Write(L"partyChannelName", partyChannelName);
out.Write(L"eventExpFactor", eventExpFactor);
}
void CreatePlayer::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.ReadEnum(L"classtype", classtype);
in.Read(L"charactername", charactername);
in.Read(L"level", level);
in.Read(L"pvpLevel", pvpLevel);
in.Read(L"warLevel", warLevel);
in.Read(L"storedLevel", storedLevel);
in.Read(L"rebirthCount", rebirthCount);
in.Read(L"ladderPoint", ladderPoint);
in.Read(L"ladderMatchCount", ladderMatchCount);
in.Read(L"ladderWinCount", ladderWinCount);
in.Read(L"ladderLoseCount", ladderLoseCount);
in.Read(L"achievementScore", achievementScore); // 3.1 by Robotex
in.Read(L"addedSkillPointByRebirth", addedSkillPointByRebirth);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"hp", hp);
in.Read(L"team", team);
in.Read(L"Equipments", Equipments);
in.Read(L"PassiveItems", PassiveItems);
in.Read(L"stateflags", stateflags);
in.Read(L"shopping", shopping);
in.Read(L"stageLicenses", stageLicenses);
in.Read(L"lives", lives);
in.Read(L"bonusLife", bonusLife);
in.Read(L"CharacterStateFlags",
reinterpret_cast<int&>(CharacterStateFlags));
in.Read(L"lastRebirthDateTime", lastRebirthDateTime);
in.Read(L"partyChannelName", partyChannelName);
in.Read(L"eventExpFactor", eventExpFactor);
}
///////////////////////////////////////////////////////////////////////////
///Createplayer //
// CreateNonPlayer
// ////////////////////////////////////////////////////////////////////////
const wchar_t* CreateNonPlayer::TypeName = L"CreateNonPlayer";
const HashType CreateNonPlayer::TypeHash =
StringUtil::Hash(CreateNonPlayer::TypeName);
void CreateNonPlayer::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"charactername", charactername);
out.Write(L"level", level);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"hp", hp);
out.Write(L"team", team);
out.Write(L"playerCnt", playerCntWhenCreated);
}
void CreateNonPlayer::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"charactername", charactername);
in.Read(L"level", level);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"hp", hp);
in.Read(L"team", team);
in.Read(L"playerCnt", playerCntWhenCreated);
}
////////////////////////////////////////////////////////////////////////
///CreateNonPlayer //
// CreateItem
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* CreateItem::TypeName = L"CreateItem";
const HashType CreateItem::TypeHash =
StringUtil::Hash(CreateItem::TypeName);
void CreateItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"itemname", itemname);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"owner", owner);
out.Write(L"stackCount", stackCount);
out.Write(L"isPrivateItem", isPrivateItem);
}
void CreateItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"itemname", itemname);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"owner", owner);
in.Read(L"stackCount", stackCount);
in.Read(L"isPrivateItem", isPrivateItem);
}
/////////////////////////////////////////////////////////////////////////////
///CreateItem //
// DiceItemCreated//////////////////////////////////////////////////////////////////////////
const wchar_t* DiceItemCreated::TypeName = L"DiceItemCreated";
const HashType DiceItemCreated::TypeHash =
StringUtil::Hash(DiceItemCreated::TypeName);
void DiceItemCreated::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"result", result);
}
void DiceItemCreated::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"result", result);
}
/////////////////////////////////////////////////////////////////////////////
///DiceItemCreated //
// CreateProjectile
// ///////////////////////////////////////////////////////////////////////
const wchar_t* CreateProjectile::TypeName = L"CreateProjectile";
const HashType CreateProjectile::TypeHash =
StringUtil::Hash(CreateProjectile::TypeName);
void CreateProjectile::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"tilename", tilename);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"targetpos", targetpos);
out.Write(L"serial", serial);
out.Write(L"owner", owner);
}
void CreateProjectile::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"tilename", tilename);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"targetpos", targetpos);
in.Read(L"serial", serial);
in.Read(L"owner", owner);
}
///////////////////////////////////////////////////////////////////////
///CreateProjectile //
// CreateStaticObject
// /////////////////////////////////////////////////////////////////////
const wchar_t* CreateStaticObject::TypeName = L"CreateStaticObject";
const HashType CreateStaticObject::TypeHash =
StringUtil::Hash(CreateStaticObject::TypeName);
void CreateStaticObject::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"objectname", objectname);
out.WriteEnum(L"objecttype", type);
out.Write(L"position", position);
out.Write(L"direction", direction);
}
void CreateStaticObject::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"objectname", objectname);
in.ReadEnum(L"objecttype", type);
in.Read(L"position", position);
in.Read(L"direction", direction);
}
/////////////////////////////////////////////////////////////////////
///CreateStaticObject //
// DestroyObject
// //////////////////////////////////////////////////////////////////////////
const wchar_t* DestroyObject::TypeName = L"DestroyObject";
const HashType DestroyObject::TypeHash =
StringUtil::Hash(DestroyObject::TypeName);
void DestroyObject::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Serial", Serial);
out.WriteEnum(L"Type", Type);
out.Write(L"Silent", Silent);
out.Write(L"Team", team);
}
void DestroyObject::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Serial", Serial);
in.ReadEnum(L"Type", Type);
in.Read(L"Silent", Silent);
in.Read(L"Team", team);
}
//////////////////////////////////////////////////////////////////////////
///DestroyObject //
// changeAction
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* ChangeAction::TypeName = L"ChangeAction";
const HashType ChangeAction::TypeHash =
StringUtil::Hash(ChangeAction::TypeName);
void ChangeAction::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"animation", animation);
out.Write(L"positoin", position);
out.Write(L"direction", direction);
out.Write(L"param", param);
}
void ChangeAction::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"animation", animation);
in.Read(L"positoin", position);
in.Read(L"direction", direction);
in.Read(L"param", param);
}
///////////////////////////////////////////////////////////////////////////
///ChangeAction //
// ChangeColState
// /////////////////////////////////////////////////////////////////////////
const wchar_t* ChangeColState::TypeName = L"ChangeColState";
const HashType ChangeColState::TypeHash =
StringUtil::Hash(ChangeColState::TypeName);
void ChangeColState::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"collision", collision);
out.Write(L"position", position);
}
void ChangeColState::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"collision", collision);
in.Read(L"position", position);
}
/////////////////////////////////////////////////////////////////////////
///ChangeColState //
// ChangeStatus
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* ChangeStatus::TypeName = L"ChangeStatus";
const HashType ChangeStatus::TypeHash =
StringUtil::Hash(ChangeStatus::TypeName);
void ChangeStatus::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"objectserial", objectserial);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"hp", hp);
out.Write(L"mp", mp);
out.Write(L"bywhom", bywhom);
out.Write(L"bywhat", bywhat);
out.Write(L"flag", flag);
out.Write(L"airComboCount", airComboCount);
}
void ChangeStatus::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"objectserial", objectserial);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"hp", hp);
in.Read(L"mp", mp);
in.Read(L"bywhom", bywhom);
in.Read(L"bywhat", bywhat);
in.Read(L"flag", flag);
in.Read(L"airComboCount", airComboCount);
}
///////////////////////////////////////////////////////////////////////////
///ChangeStatus //
// UseItem
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* UseItem::TypeName = L"UseItem";
const HashType UseItem::TypeHash =
StringUtil::Hash(UseItem::TypeName);
void UseItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"itemid", itemid);
}
void UseItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"itemid", itemid);
}
////////////////////////////////////////////////////////////////////////////////
///UseItem //
// UseItemEx
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* UseItemEx::TypeName = L"UseItemEx";
const HashType UseItemEx::TypeHash =
StringUtil::Hash(UseItemEx::TypeName);
void UseItemEx::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void UseItemEx::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////////
///UseItemEx //
// EquipItem
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* EquipItem::TypeName = L"EquipItem";
const HashType EquipItem::TypeHash =
StringUtil::Hash(EquipItem::TypeName);
void EquipItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"ItemHash", ItemHash);
out.Write(L"Position", Position);
out.Write(L"instanceEx", instanceEx);
}
void EquipItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"ItemHash", ItemHash);
in.Read(L"Position", Position);
in.Read(L"instanceEx", instanceEx);
}
//////////////////////////////////////////////////////////////////////////////
///EquipItem //
// EquipmentSwapped
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* EquipmentSwapped::TypeName = L"EquipmentSwapped";
const HashType EquipmentSwapped::TypeHash =
StringUtil::Hash(EquipmentSwapped::TypeName);
void EquipmentSwapped::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"NewIndex", NewIndex);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"NewEquipments", NewEquipments);
out.WriteEnum(L"Result", Result);
}
void EquipmentSwapped::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"NewIndex", NewIndex);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"NewEquipments", NewEquipments);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////////
///EquipmentSwapped //
// CashEquipmentSwapped
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* CashEquipmentSwapped::TypeName = L"CashEquipmentSwapped";
const HashType CashEquipmentSwapped::TypeHash =
StringUtil::Hash(CashEquipmentSwapped::TypeName);
void CashEquipmentSwapped::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"NewIndex", NewIndex);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"NewEquipments", NewEquipments);
out.WriteEnum(L"Result", Result);
}
void CashEquipmentSwapped::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"NewIndex", NewIndex);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"NewEquipments", NewEquipments);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////////
///CashEquipmentSwapped //
// PetInfo
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* PetInfo::TypeName = L"PetInfo";
const HashType PetInfo::TypeHash =
StringUtil::Hash(PetInfo::TypeName);
void PetInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
// out.Write( L"ownerserial", ownerserial );
out.Write(L"PetDataWithPos", PetDataWithPos);
}
void PetInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
// in.Read( L"ownerserial", ownerserial );
in.Read(L"PetDataWithPos", PetDataWithPos);
}
////////////////////////////////////////////////////////////////////////////////
///PetInfo //
/////////////////////////////////////////////////////////////////////////////
///PetUpdated //
const wchar_t* PetUpdated::TypeName = L"PetUpdated";
const HashType PetUpdated::TypeHash =
StringUtil::Hash(PetUpdated::TypeName);
void PetUpdated::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"PetExpression", PetExpression);
out.Write(L"PetSerial", PetSerial);
out.Write(L"PetData", PetData);
out.Write(L"PetItemPosition", PetItemPosition);
}
void PetUpdated::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"PetExpression", PetExpression);
in.Read(L"PetSerial", PetSerial);
in.Read(L"PetData", PetData);
in.Read(L"PetItemPosition", PetItemPosition);
}
// PetUpdated
// /////////////////////////////////////////////////////////////////////////////
// PetEquip
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* PetEquip::TypeName = L"PetEquip";
const HashType PetEquip::TypeHash =
StringUtil::Hash(PetEquip::TypeName);
void PetEquip::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"PetObjectSerial", PetObjectSerial);
out.Write(L"ItemHash", ItemHash);
out.Write(L"Position", Position);
out.Write(L"instanceEx", instanceEx);
}
void PetEquip::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"PetObjectSerial", PetObjectSerial);
in.Read(L"ItemHash", ItemHash);
in.Read(L"Position", Position);
in.Read(L"instanceEx", instanceEx);
}
///////////////////////////////////////////////////////////////////////////////
///PetEquip //
// PetEmotion
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* PetEmotion::TypeName = L"PetEmotion";
const HashType PetEmotion::TypeHash =
StringUtil::Hash(PetEmotion::TypeName);
void PetEmotion::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetSerial", PetSerial);
out.WriteEnum(L"FeelingState", FeelingState);
}
void PetEmotion::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetSerial", PetSerial);
in.ReadEnum(L"FeelingState", FeelingState);
}
/////////////////////////////////////////////////////////////////////////////
///PetEmotion //
// PetLevelUp
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* PetLevelUp::TypeName = L"PetLevelUp";
const HashType PetLevelUp::TypeHash =
StringUtil::Hash(PetLevelUp::TypeName);
void PetLevelUp::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"PetSerial", PetSerial);
out.Write(L"PetData", PetData);
}
void PetLevelUp::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"PetSerial", PetSerial);
in.Read(L"PetData", PetData);
}
/////////////////////////////////////////////////////////////////////////////
///PetLevelUp //
// UpdateItem
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* UpdateItem::TypeName = L"UpdateItem";
const HashType UpdateItem::TypeHash =
StringUtil::Hash(UpdateItem::TypeName);
void UpdateItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
}
void UpdateItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
}
/////////////////////////////////////////////////////////////////////////////
///UpdateItem //
// ListPetItem
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* ListPetItem::TypeName = L"ListPetItem";
const HashType ListPetItem::TypeHash =
StringUtil::Hash(ListPetItem::TypeName);
void ListPetItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetsItems", PetsItems);
}
void ListPetItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetsItems", PetsItems);
}
/////////////////////////////////////////////////////////////////////////////
///ListPetItem //
// MoveInventoryToPetItem
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* MoveItemInventoryToPet::TypeName = L"MoveItemInventoryToPet";
const HashType MoveItemInventoryToPet::TypeHash =
StringUtil::Hash(MoveItemInventoryToPet::TypeName);
void MoveItemInventoryToPet::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetSerial", PetSerial);
out.Write(L"Inventory", Inventory);
out.WriteEnum(L"PetSlotType", PetSlotType);
out.Write(L"PetSlotPosition", PetSlotPosition);
}
void MoveItemInventoryToPet::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetSerial", PetSerial);
in.Read(L"Inventory", Inventory);
in.ReadEnum(L"PetSlotType", PetSlotType);
in.Read(L"PetSlotPosition", PetSlotPosition);
}
/////////////////////////////////////////////////////////////////////////////
///MoveInventoryToPetItem //
// MoveItemInPetInven
// ////////////////////////////////////////////////////////////////////////
const wchar_t* MoveItemInPetInven::TypeName = L"MoveItemInPetInven";
const HashType MoveItemInPetInven::TypeHash =
StringUtil::Hash(MoveItemInPetInven::TypeName);
void MoveItemInPetInven::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetSerial", PetSerial);
out.WriteEnum(L"SourcePositionType", SourcePositionType);
out.Write(L"SourcePosition", SourcePosition);
out.WriteEnum(L"TargetPositionType", TargetPositionType);
out.Write(L"TargetPosition", TargetPosition);
}
void MoveItemInPetInven::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetSerial", PetSerial);
in.ReadEnum(L"SourcePositionType", SourcePositionType);
in.Read(L"SourcePosition", SourcePosition);
in.ReadEnum(L"TargetPositionType", TargetPositionType);
in.Read(L"TargetPosition", TargetPosition);
}
////////////////////////////////////////////////////////////////////////
///MoveItemInPetInven //
// PetsCaredBySchool
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* PetsCaredBySchool::TypeName = L"PetsCaredBySchool";
const HashType PetsCaredBySchool::TypeHash =
StringUtil::Hash(PetsCaredBySchool::TypeName);
void PetsCaredBySchool::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"OwnerSerial", OwnerSerial);
out.Write(L"CaredPets", CaredPets);
}
void PetsCaredBySchool::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"OwnerSerial", OwnerSerial);
in.Read(L"CaredPets", CaredPets);
}
//////////////////////////////////////////////////////////////////////////////
///PetsCaredBySchool //
// CaredPetUpdated
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* CaredPetUpdated::TypeName = L"CaredPetUpdated";
const HashType CaredPetUpdated::TypeHash =
StringUtil::Hash(CaredPetUpdated::TypeName);
void CaredPetUpdated::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"OwnerSerial", OwnerSerial);
out.Write(L"CaredPet", CaredPet);
}
void CaredPetUpdated::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"OwnerSerial", OwnerSerial);
in.Read(L"CaredPet", CaredPet);
}
////////////////////////////////////////////////////////////////////////////////
///CaredPetUpdated //
// CaredPetTakenOut
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* CaredPetTakenOut::TypeName = L"CaredPetTakenOut";
const HashType CaredPetTakenOut::TypeHash =
StringUtil::Hash(CaredPetTakenOut::TypeName);
void CaredPetTakenOut::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"OwnerSerial", OwnerSerial);
out.Write(L"CaredPetSerial", CaredPetSerial);
}
void CaredPetTakenOut::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"OwnerSerial", OwnerSerial);
in.Read(L"CaredPetSerial", CaredPetSerial);
}
///////////////////////////////////////////////////////////////////////////////
///CaredPetTakenOut //
// RemovePet
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* RemovePet::TypeName = L"RemovePet";
const HashType RemovePet::TypeHash =
StringUtil::Hash(RemovePet::TypeName);
void RemovePet::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetSerial", PetSerial);
}
void RemovePet::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetSerial", PetSerial);
}
///////////////////////////////////////////////////////////////////////////////
///RemovePet //
// TakeOutAllPetItems
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* TakeOutAllPetItems::TypeName = L"TakeOutAllPetItems";
const HashType TakeOutAllPetItems::TypeHash =
StringUtil::Hash(TakeOutAllPetItems::TypeName);
void TakeOutAllPetItems::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetSerial", PetSerial);
out.WriteEnum(L"Result", Result);
}
void TakeOutAllPetItems::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetSerial", PetSerial);
in.ReadEnum(L"Result", Result);
}
///////////////////////////////////////////////////////////////////////////////
///TakeOutAllPetItems //
// DropItemInPetInventory
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* DropItemInPetInventory::TypeName = L"DropItemInPetInventory";
const HashType DropItemInPetInventory::TypeHash =
StringUtil::Hash(DropItemInPetInventory::TypeName);
void DropItemInPetInventory::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PetSerial", PetSerial);
out.WriteEnum(L"PositionType", PositionType);
out.Write(L"Position", Position);
out.Write(L"StackCount", StackCount);
}
void DropItemInPetInventory::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PetSerial", PetSerial);
in.ReadEnum(L"PositionType", PositionType);
in.Read(L"Position", Position);
in.Read(L"StackCount", StackCount);
}
///////////////////////////////////////////////////////////////////////////////
///DropItemInPetInventory //
// LevelUp
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* LevelUp::TypeName = L"LevelUp";
const HashType LevelUp::TypeHash =
StringUtil::Hash(LevelUp::TypeName);
void LevelUp::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"level", level);
out.WriteEnum(L"expType", expType);
}
void LevelUp::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"level", level);
in.ReadEnum(L"expType", expType);
}
////////////////////////////////////////////////////////////////////////////////
///LevelUp //
// PlayerDied
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* PlayerDied::TypeName = L"PlayerDied";
const HashType PlayerDied::TypeHash =
StringUtil::Hash(PlayerDied::TypeName);
void PlayerDied::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"hitplayerserial", hitplayerserial);
}
void PlayerDied::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"hitplayerserial", hitplayerserial);
}
/////////////////////////////////////////////////////////////////////////////
///PlayerDied //
// Revive
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* Revive::TypeName = L"Revive";
const HashType Revive::TypeHash = StringUtil::Hash(Revive::TypeName);
void Revive::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"hp", hp);
out.Write(L"mp", mp);
out.Write(L"life", life);
out.Write(L"bonusLife", bonusLife);
out.Write(L"usableBonusLife", usableBonusLife);
out.Write(L"reviveCount", reviveCount); // 3.1 by Robotex
}
void Revive::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"hp", hp);
in.Read(L"mp", mp);
in.Read(L"life", life);
in.Read(L"bonusLife", bonusLife);
in.Read(L"usableBonusLife", usableBonusLife);
in.Read(L"reviveCount", reviveCount); // 3.1 by Robotex
}
/////////////////////////////////////////////////////////////////////////////////
///Revive //
// InstantCoinRevive
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* InstantCoinRevive::TypeName = L"InstantCoinRevive";
const HashType InstantCoinRevive::TypeHash =
StringUtil::Hash(InstantCoinRevive::TypeName);
void InstantCoinRevive::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Result", static_cast<const int>(Result));
}
void InstantCoinRevive::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Result", reinterpret_cast<int&>(Result));
}
/////////////////////////////////////////////////////////////////////////////////
///InstantCoinRevive //
// SkillPoint
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* SkillPoint::TypeName = L"SkillPoint";
const HashType SkillPoint::TypeHash =
StringUtil::Hash(SkillPoint::TypeName);
void SkillPoint::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"skillpoint", skillpoint);
}
void SkillPoint::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"skillpoint", skillpoint);
}
/////////////////////////////////////////////////////////////////////////////
///SkillPoint //
// SkillPointPlus
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* SkillPointPlus::TypeName = L"SkillPointPlus";
const HashType SkillPointPlus::TypeHash =
StringUtil::Hash(SkillPointPlus::TypeName);
void SkillPointPlus::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"skillpoint", skillpoint);
out.Write(L"addedSkillPointPlus", addedSkillPointPlus);
out.Write(L"storedSkillPoint", storedSkillPoint);
}
void SkillPointPlus::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"skillpoint", skillpoint);
in.Read(L"addedSkillPointPlus", addedSkillPointPlus);
in.Read(L"storedSkillPoint", storedSkillPoint);
}
/////////////////////////////////////////////////////////////////////////////
///SkillPointPlus //
// Money
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* Money::TypeName = L"Money";
const HashType Money::TypeHash = StringUtil::Hash(Money::TypeName);
void Money::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CurrentMoney", CurrentMoney);
}
void Money::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CurrentMoney", CurrentMoney);
}
//////////////////////////////////////////////////////////////////////////////////
///Money //
// PvpLevelExp
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* PvpLevelExp::TypeName = L"PvpLevelExp";
const HashType PvpLevelExp::TypeHash =
StringUtil::Hash(PvpLevelExp::TypeName);
void PvpLevelExp::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"pvpLevel", pvpLevel);
out.Write(L"pvpXp", pvpXp);
}
void PvpLevelExp::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"pvpLevel", pvpLevel);
in.Read(L"pvpXp", pvpXp);
}
////////////////////////////////////////////////////////////////////////////
///PvpLevelExp //
// MissionClear
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* MissionClear::TypeName = L"MissionClear";
const HashType MissionClear::TypeHash =
StringUtil::Hash(MissionClear::TypeName);
void MissionClear::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"success", success);
out.Write(L"elapstime", elapstime);
out.Write(L"fountsecret", foundsecret);
out.Write(L"eventExpFactor", eventExpFactor);
out.Write(L"bossItemGainCount", bossItemGainCount);
out.Write(L"ladderPoint", ladderPoint);
// out.Write( L"allPlayerReviveCount",allPlayerReviveCount );
out.Write(L"playerInfos", playerInfos);
}
void MissionClear::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"success", success);
in.Read(L"elapstime", elapstime);
in.Read(L"fountsecret", foundsecret);
in.Read(L"eventExpFactor", eventExpFactor);
in.Read(L"bossItemGainCount", bossItemGainCount);
in.Read(L"ladderPoint", ladderPoint);
// in.Read( L"allPlayerReviveCount", allPlayerReviveCount );
in.Read(L"playerInfos", playerInfos);
}
///////////////////////////////////////////////////////////////////////////
///MissionClear //
// MissionClearReward
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* MissionClearReward::TypeName = L"MissionClearReward";
const HashType MissionClearReward::TypeHash =
StringUtil::Hash(MissionClearReward::TypeName);
void MissionClearReward::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"bossItems", bossItems);
out.Write(L"bonusItems", bonusItems);
out.Write(L"eventItems", eventItems); // 3.1 by Robotex
}
void MissionClearReward::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"bossItems", bossItems);
in.Read(L"bonusItems", bonusItems);
in.Read(L"eventItems", eventItems); // 3.1 by Robotex
}
///////////////////////////////////////////////////////////////////////////
///MissionClear //
// MoveItem
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* MoveItem::TypeName = L"MoveItem";
const HashType MoveItem::TypeHash =
StringUtil::Hash(MoveItem::TypeName);
void MoveItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"pbag", pbag);
out.Write(L"ppos", ppos);
out.Write(L"nbag", nbag);
out.Write(L"npos", npos);
}
void MoveItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"pbag", pbag);
in.Read(L"ppos", ppos);
in.Read(L"nbag", nbag);
in.Read(L"npos", npos);
}
///////////////////////////////////////////////////////////////////////////////
///MoveItem //
// StackItem
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* StackItem::TypeName = L"StackItem";
const HashType StackItem::TypeHash =
StringUtil::Hash(StackItem::TypeName);
void StackItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"sbag", sbag);
out.Write(L"spos", spos);
out.Write(L"tbag", tbag);
out.Write(L"tpos", tpos);
out.Write(L"count", count);
}
void StackItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"sbag", sbag);
in.Read(L"spos", spos);
in.Read(L"tbag", tbag);
in.Read(L"tpos", tpos);
in.Read(L"count", count);
}
///////////////////////////////////////////////////////////////////////////////
///StackItem //
// DropItem
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* DropItem::TypeName = L"DropItem";
const HashType DropItem::TypeHash =
StringUtil::Hash(DropItem::TypeName);
void DropItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"bag", bag);
out.Write(L"pos", pos);
out.Write(L"DroppedCount", DroppedCount);
out.Write(L"StackedCount", StackedCount);
}
void DropItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"bag", bag);
in.Read(L"pos", pos);
in.Read(L"DroppedCount", DroppedCount);
in.Read(L"StackedCount", StackedCount);
}
///////////////////////////////////////////////////////////////////////////////
///DropItem //
// AcquireItem
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* AcquireItem::TypeName = L"AcquireItem";
const HashType AcquireItem::TypeHash =
StringUtil::Hash(AcquireItem::TypeName);
void AcquireItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ItemId", ItemId);
out.Write(L"Bag", Bag);
out.Write(L"Pos", Pos);
out.Write(L"StackedCount", StackedCount);
out.Write(L"instanceEx", instanceEx);
out.Write(L"ItemSerial", ItemSerial);
}
void AcquireItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ItemId", ItemId);
in.Read(L"Bag", Bag);
in.Read(L"Pos", Pos);
in.Read(L"StackedCount", StackedCount);
in.Read(L"instanceEx", instanceEx);
in.Read(L"ItemSerial", ItemSerial);
}
////////////////////////////////////////////////////////////////////////////
///AcquireItem //
// NoticeAcquireItemInfo
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* NoticeAcquireItemInfo::TypeName = L"NoticeAcquireItemInfo";
const HashType NoticeAcquireItemInfo::TypeHash =
StringUtil::Hash(NoticeAcquireItemInfo::TypeName);
void NoticeAcquireItemInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"ItemId", ItemId);
out.Write(L"instanceEx", instanceEx);
}
void NoticeAcquireItemInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"ItemId", ItemId);
in.Read(L"instanceEx", instanceEx);
}
////////////////////////////////////////////////////////////////////////////
///AcquireItem //
// AcquirePvPItem
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* AcquirePvPItem::TypeName = L"AcquirePvPItem";
const HashType AcquirePvPItem::TypeHash =
StringUtil::Hash(AcquirePvPItem::TypeName);
void AcquirePvPItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"itemid", itemid);
}
void AcquirePvPItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"itemid", itemid);
}
////////////////////////////////////////////////////////////////////////////
///AcquirePvPItem //
// UsePvPItem
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* UsePvPItem::TypeName = L"UsePvPItem";
const HashType UsePvPItem::TypeHash =
StringUtil::Hash(UsePvPItem::TypeName);
void UsePvPItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"itemid", itemid);
}
void UsePvPItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"itemid", itemid);
}
////////////////////////////////////////////////////////////////////////////
///UsePvPItem //
// DropPvPItem
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* DropPvPItem::TypeName = L"DropPvPItem";
const HashType DropPvPItem::TypeHash =
StringUtil::Hash(DropPvPItem::TypeName);
void DropPvPItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
}
void DropPvPItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
}
////////////////////////////////////////////////////////////////////////////
///DropPvPItem //
// AddMinimapPing
// /////////////////////////////////////////////////////////////////////////
const wchar_t* AddMinimapPing::TypeName = L"AddMinimapPing";
const HashType AddMinimapPing::TypeHash =
StringUtil::Hash(AddMinimapPing::TypeName);
void AddMinimapPing::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"pingid", pingid);
out.Write(L"position", position);
out.WriteEnum(L"type", type);
}
void AddMinimapPing::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"pingid", pingid);
in.Read(L"position", position);
in.ReadEnum(L"type", type);
}
/////////////////////////////////////////////////////////////////////////
///AddMinimapPing //
// RemoveMinimapPing
// //////////////////////////////////////////////////////////////////////
const wchar_t* RemoveMinimapPing::TypeName = L"RemoveMinimapPing";
const HashType RemoveMinimapPing::TypeHash =
StringUtil::Hash(RemoveMinimapPing::TypeName);
void RemoveMinimapPing::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"pingid", pingid);
}
void RemoveMinimapPing::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"pingid", pingid);
}
//////////////////////////////////////////////////////////////////////
///RemoveMinimapPing //
// DisplayTextEvent
// ///////////////////////////////////////////////////////////////////////
const wchar_t* DisplayTextEvent::TypeName = L"DisplayTextEvent";
const HashType DisplayTextEvent::TypeHash =
StringUtil::Hash(DisplayTextEvent::TypeName);
void DisplayTextEvent::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"textId", textId);
out.Write(L"param", param);
}
void DisplayTextEvent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"textId", textId);
in.Read(L"param", param);
};
///////////////////////////////////////////////////////////////////////
///DisplayTextEvent //
// DisplayText
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* DisplayText::TypeName = L"DisplayText";
const HashType DisplayText::TypeHash =
StringUtil::Hash(DisplayText::TypeName);
void DisplayText::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"message", message);
}
void DisplayText::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"message", message);
};
////////////////////////////////////////////////////////////////////////////
///DisplayText //
// DisplayTimer
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* DisplayTimer::TypeName = L"DisplayTimer";
const HashType DisplayTimer::TypeHash =
StringUtil::Hash(DisplayTimer::TypeName);
void DisplayTimer::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"seconds", seconds);
}
void DisplayTimer::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"seconds", seconds);
}
///////////////////////////////////////////////////////////////////////////
///DisplayTimer //
// PlayEvent
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* PlayEvent::TypeName = L"PlayEvent";
const HashType PlayEvent::TypeHash =
StringUtil::Hash(PlayEvent::TypeName);
void PlayEvent::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"eventid", eventid);
out.Write(L"param", param);
}
void PlayEvent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"eventid", eventid);
in.Read(L"param", param);
}
//////////////////////////////////////////////////////////////////////////////
///PlayEvent //
// PlayClientStageEvent
// ///////////////////////////////////////////////////////////////////
const wchar_t* PlayClientStageEvent::TypeName = L"PlayClientStageEvent";
const HashType PlayClientStageEvent::TypeHash =
StringUtil::Hash(PlayClientStageEvent::TypeName);
void PlayClientStageEvent::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"eventId", eventId);
out.Write(L"eventParam", eventParam);
}
void PlayClientStageEvent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"eventId", eventId);
in.Read(L"eventParam", eventParam);
}
///////////////////////////////////////////////////////////////////
///PlayClientStageEvent //
// CreateStructure
// ////////////////////////////////////////////////////////////////////////
const wchar_t* CreateStructure::TypeName = L"CreateStructure";
const HashType CreateStructure::TypeHash =
StringUtil::Hash(CreateStructure::TypeName);
void CreateStructure::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"structureserial", structureserial);
out.Write(L"structurename", structurename);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"currenthp", currenthp);
out.Write(L"team", team);
}
void CreateStructure::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"structureserial", structureserial);
in.Read(L"structurename", structurename);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"currenthp", currenthp);
in.Read(L"team", team);
}
////////////////////////////////////////////////////////////////////////
///CreateStructure //
// CreateStructure
// ////////////////////////////////////////////////////////////////////////
const wchar_t* CreateVehicle::TypeName = L"CreateVehicle";
const HashType CreateVehicle::TypeHash =
StringUtil::Hash(CreateVehicle::TypeName);
void CreateVehicle::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"vehicleserial", vehicleserial);
out.Write(L"vehiclename", vehiclename);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"currenthp", currenthp);
out.Write(L"team", team);
}
void CreateVehicle::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"vehicleserial", vehicleserial);
in.Read(L"vehiclename", vehiclename);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"currenthp", currenthp);
in.Read(L"team", team);
}
////////////////////////////////////////////////////////////////////////
///CreateStructure //
// Notice
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* Notice::TypeName = L"Notice";
const HashType Notice::TypeHash = StringUtil::Hash(Notice::TypeName);
void Notice::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"id", id);
out.Write(L"position", position);
out.Write(L"direction", direction);
out.Write(L"parameters", parameters);
}
void Notice::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"id", id);
in.Read(L"position", position);
in.Read(L"direction", direction);
in.Read(L"parameters", parameters);
}
/////////////////////////////////////////////////////////////////////////////////
///Notice //
// PauseObject
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* PauseObject::TypeName = L"PauseObject";
const HashType PauseObject::TypeHash =
StringUtil::Hash(PauseObject::TypeName);
void PauseObject::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"pausetime", pausetime);
}
void PauseObject::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"pausetime", pausetime);
}
////////////////////////////////////////////////////////////////////////////
///PauseObject //
// PauseCinematict
// ////////////////////////////////////////////////////////////////////////
const wchar_t* PlayCinematic::TypeName = L"PlayCinematic";
const HashType PlayCinematic::TypeHash =
StringUtil::Hash(PlayCinematic::TypeName);
void PlayCinematic::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"cinematic", cinematic);
}
void PlayCinematic::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"cinematic", cinematic);
}
//////////////////////////////////////////////////////////////////////////
///PlayCinematic //
// XpGain
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* XpGain::TypeName = L"XpGain";
const HashType XpGain::TypeHash = StringUtil::Hash(XpGain::TypeName);
void XpGain::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"storyXp", storyXp);
out.Write(L"pvpXp", pvpXp);
out.Write(L"warXp", warXp);
out.Write(L"beKilledNpc", beKilledNpc);
}
void XpGain::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"storyXp", storyXp);
in.Read(L"pvpXp", pvpXp);
in.Read(L"warXp", warXp);
in.Read(L"beKilledNpc", beKilledNpc);
}
///////////////////////////////////////////////////////////////////////////
///XpGain //
// GoldGain
// ///////////////////////////////////////////////////////////////////////////
// TODO : ?????? ???? ???? ??? ???? ?????? ???? ???ÿ? Money?? Add??????? ???????
// ?????...
// ????? GoldGain????? ???? ????? Gold?? ???Ÿ??? ?????? ?????? ?????????????
// ????Money?? ??? ??????°? ????.. ????? ???? ???????..
const wchar_t* GoldGain::TypeName = L"GoldGain";
const HashType GoldGain::TypeHash =
StringUtil::Hash(GoldGain::TypeName);
void GoldGain::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"serial", serial);
out.Write(L"money", money);
}
void GoldGain::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"serial", serial);
in.Read(L"money", money);
}
///////////////////////////////////////////////////////////////////////////
///GoldGain //
// AcquireLicense
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* AcquireLicense::TypeName = L"AcquireLicense";
const HashType AcquireLicense::TypeHash =
StringUtil::Hash(AcquireLicense::TypeName);
void AcquireLicense::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"stageLicense", stageLicense);
out.Write(L"sharedOtherPlayers", sharedOtherPlayers); // 3.1 by ultimate
}
void AcquireLicense::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"stageLicense", stageLicense);
in.Read(L"sharedOtherPlayers", sharedOtherPlayers); // 3.1 by ultimate
}
///////////////////////////////////////////////////////////////////////////
///AcquireLicense //
// AcquireLicense
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* AcquireSkillLicense::TypeName = L"AcquireSkillLicense";
const HashType AcquireSkillLicense::TypeHash =
StringUtil::Hash(AcquireSkillLicense::TypeName);
void AcquireSkillLicense::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"skillLicense", skillLicense);
}
void AcquireSkillLicense::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"skillLicense", skillLicense);
}
///////////////////////////////////////////////////////////////////////////
///AcquireLicense //
// ChangeState
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* ChangeState::TypeName = L"ChangeState";
const HashType ChangeState::TypeHash =
StringUtil::Hash(ChangeState::TypeName);
void ChangeState::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"id", id);
out.Write(L"level", level);
out.Write(L"byWhom", byWhom);
out.Write(L"realTimeDuration", realTimeDuration); // 3.1 by Robotex
}
void ChangeState::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"id", id);
in.Read(L"level", level);
in.Read(L"byWhom", byWhom);
in.Read(L"realTimeDuration", realTimeDuration); // 3.1 by Robotex
}
//////////////////////////////////////////////////////////////////////////////////
///ChangeState //
// MoveQuickSlot
// //////////////////////////////////////////////////////////////////////////
const wchar_t* MoveQuickSlot::TypeName = L"MoveQuickSlot";
const HashType MoveQuickSlot::TypeHash =
StringUtil::Hash(MoveQuickSlot::TypeName);
void MoveQuickSlot::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ppos", ppos);
out.Write(L"npos", npos);
}
void MoveQuickSlot::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ppos", ppos);
in.Read(L"npos", npos);
}
//////////////////////////////////////////////////////////////////////////
///MoveQuickSlot //
// VoteStart
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* VoteStart::TypeName = L"VoteStart";
const HashType VoteStart::TypeHash =
StringUtil::Hash(VoteStart::TypeName);
void VoteStart::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Serial", serial);
out.WriteEnum(L"type", type);
out.Write(L"targetStage", targetStage);
out.Write(L"charName", charName);
}
void VoteStart::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Serial", serial);
in.ReadEnum(L"type", type);
in.Read(L"targetStage", targetStage);
in.Read(L"charName", charName);
}
//////////////////////////////////////////////////////////////////////////////
///VoteStart //
// AutoVoteStart
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* AutoVoteStart::TypeName = L"AutoVoteStart";
const HashType AutoVoteStart::TypeHash =
StringUtil::Hash(AutoVoteStart::TypeName);
void AutoVoteStart::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"targetStage", targetStage);
}
void AutoVoteStart::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"targetStage", targetStage);
}
//////////////////////////////////////////////////////////////////////////////
///VoteStart //
// StartPersonalVoting
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* StartPersonalVoting::TypeName = L"StartPersonalVoting";
const HashType StartPersonalVoting::TypeHash =
StringUtil::Hash(StartPersonalVoting::TypeName);
void StartPersonalVoting::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"charName", charName);
}
void StartPersonalVoting::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"charName", charName);
}
//////////////////////////////////////////////////////////////////////////////
///StartPersonalVoting //
// ResultPersonalVoting
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* ResultPersonalVoting::TypeName = L"ResultPersonalVoting";
const HashType ResultPersonalVoting::TypeHash =
StringUtil::Hash(ResultPersonalVoting::TypeName);
void ResultPersonalVoting::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"type", type);
out.Write(L"charName", charName);
}
void ResultPersonalVoting::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"type", type);
in.Read(L"charName", charName);
}
//////////////////////////////////////////////////////////////////////////////
///ResultPersonalVoting //
// EnterShop
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* EnterShop::TypeName = L"EnterShop";
const HashType EnterShop::TypeHash =
StringUtil::Hash(EnterShop::TypeName);
void EnterShop::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.WriteEnum(L"shopnumber", shopnumber);
out.Write(L"param", param);
}
void EnterShop::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.ReadEnum(L"shopnumber", shopnumber);
in.Read(L"param", param);
}
//////////////////////////////////////////////////////////////////////////////
///EnterShop //
// LeaveShop
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* LeaveShop::TypeName = L"LeaveShop";
const HashType LeaveShop::TypeHash =
StringUtil::Hash(LeaveShop::TypeName);
void LeaveShop::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"playerserial", playerserial);
out.Write(L"position", position);
out.Write(L"direction", direction);
}
void LeaveShop::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"playerserial", playerserial);
in.Read(L"position", position);
in.Read(L"direction", direction);
}
//////////////////////////////////////////////////////////////////////////////
///LeaveShop //
// Buy
// ////////////////////////////////////////////////////////////////////////////////////
const wchar_t* Buy::TypeName = L"Buy";
const HashType Buy::TypeHash = StringUtil::Hash(Buy::TypeName);
void Buy::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"itemid", itemid);
out.Write(L"count", count);
out.Write(L"bag", bag);
out.Write(L"pos", pos);
out.Write(L"instanceEx", instanceEx);
out.Write(L"money", money);
}
void Buy::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"itemid", itemid);
in.Read(L"count", count);
in.Read(L"bag", bag);
in.Read(L"pos", pos);
in.Read(L"instanceEx", instanceEx);
in.Read(L"money", money);
}
// 3
////////////////////////////////////////////////////////////////////////////////////
///Buy //
// BuyBack
// ////////////////////////////////////////////////////////////////////////////////////
const wchar_t* BuyBack::TypeName = L"BuyBack";
const HashType BuyBack::TypeHash =
StringUtil::Hash(BuyBack::TypeName);
void BuyBack::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"itemid", itemid);
out.Write(L"count", count);
out.Write(L"bag", bag);
out.Write(L"pos", pos);
out.Write(L"instanceEx", instanceEx);
out.Write(L"money", money);
}
void BuyBack::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"itemid", itemid);
in.Read(L"count", count);
in.Read(L"bag", bag);
in.Read(L"pos", pos);
in.Read(L"instanceEx", instanceEx);
in.Read(L"money", money);
}
// 3
////////////////////////////////////////////////////////////////////////////////////
///BuyBack //
// BuyBarterItem
// ////////////////////////////////////////////////////////////////////////////////////
const wchar_t* BuyBarterItem::TypeName = L"BuyBarterItem";
const HashType BuyBarterItem::TypeHash =
StringUtil::Hash(BuyBarterItem::TypeName);
void BuyBarterItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"barterItemId", barterItemId);
out.Write(L"count", count);
}
void BuyBarterItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"barterItemId", barterItemId);
in.Read(L"count", count);
}
// 3
////////////////////////////////////////////////////////////////////////////////////
///BuyBarterItem //
// Sell
// ///////////////////////////////////////////////////////////////////////////////////
const wchar_t* Sell::TypeName = L"Sell";
const HashType Sell::TypeHash = StringUtil::Hash(Sell::TypeName);
void Sell::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"bag", bag);
out.Write(L"pos", pos);
}
void Sell::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"bag", bag);
in.Read(L"pos", pos);
}
///////////////////////////////////////////////////////////////////////////////////
///Sell //
// VoteOn
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* VoteOn::TypeName = L"VoteOn";
const HashType VoteOn::TypeHash = StringUtil::Hash(VoteOn::TypeName);
void VoteOn::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"yes", yes);
out.Write(L"no", no);
}
void VoteOn::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"yes", yes);
in.Read(L"no", no);
}
/////////////////////////////////////////////////////////////////////////////////
///VoteOn //
// Trade
// ./////////////////////////////////////////////////////////////////////////////////
const wchar_t* Trade::TypeName = L"Trade";
const HashType Trade::TypeHash = StringUtil::Hash(Trade::TypeName);
void Trade::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Trade::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////////////
///Trade //
// VoteResult
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* VoteResult::TypeName = L"VoteResult";
const HashType VoteResult::TypeHash =
StringUtil::Hash(VoteResult::TypeName);
void VoteResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"yes", yes);
out.Write(L"no", no);
}
void VoteResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"yes", yes);
in.Read(L"no", no);
}
/////////////////////////////////////////////////////////////////////////////
///VoteResult //
// VoteFailed
// /////////////////////////////////////////////////////////////////////////////
const wchar_t* VoteFailed::TypeName = L"VoteFailed";
const HashType VoteFailed::TypeHash =
StringUtil::Hash(VoteFailed::TypeName);
void VoteFailed::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void VoteFailed::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
/////////////////////////////////////////////////////////////////////////////
///VoteFailed //
// RequestTrade
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* RequestTrade::TypeName = L"RequestTrade";
const HashType RequestTrade::TypeHash =
StringUtil::Hash(RequestTrade::TypeName);
void RequestTrade::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
}
void RequestTrade::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
}
///////////////////////////////////////////////////////////////////////////
///RequestTrade //
// AddTradeItem
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* AddTradeItem::TypeName = L"AddTradeItem";
const HashType AddTradeItem::TypeHash =
StringUtil::Hash(AddTradeItem::TypeName);
void AddTradeItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"itemid", itemid);
out.Write(L"count", count);
out.Write(L"instanceEx", instanceEx);
}
void AddTradeItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"itemid", itemid);
in.Read(L"count", count);
in.Read(L"instanceEx", instanceEx);
}
///////////////////////////////////////////////////////////////////////////
///AddTradeItem //
// AddTradePetItem
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* AddTradePetItem::TypeName = L"AddTradePetItem";
const HashType AddTradePetItem::TypeHash =
StringUtil::Hash(AddTradePetItem::TypeName);
void AddTradePetItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"itemid", itemid);
out.Write(L"count", count);
out.Write(L"instanceEx", instanceEx);
out.Write(L"Pet", Pet);
}
void AddTradePetItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"itemid", itemid);
in.Read(L"count", count);
in.Read(L"instanceEx", instanceEx);
in.Read(L"Pet", Pet);
}
///////////////////////////////////////////////////////////////////////////
///AddTradePetItem //
// AddTradeMoney
// //////////////////////////////////////////////////////////////////////////
const wchar_t* AddTradeMoney::TypeName = L"AddTradeMoeny";
const HashType AddTradeMoney::TypeHash =
StringUtil::Hash(AddTradeMoney::TypeName);
void AddTradeMoney::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
out.Write(L"money", money);
}
void AddTradeMoney::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
in.Read(L"money", money);
}
//////////////////////////////////////////////////////////////////////////
///AddTradeMoney //
// ReadyToTrade
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* ReadyToTrade::TypeName = L"ReadyToTrade";
const HashType ReadyToTrade::TypeHash =
StringUtil::Hash(ReadyToTrade::TypeName);
void ReadyToTrade::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"serial", serial);
}
void ReadyToTrade::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"serial", serial);
}
///////////////////////////////////////////////////////////////////////////
///ReadyToTrade //
// ConfirmTrade
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* ConfirmTrade::TypeName = L"ConfirmTrade";
const HashType ConfirmTrade::TypeHash =
StringUtil::Hash(ConfirmTrade::TypeName);
void ConfirmTrade::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"tradePlayers", tradePlayers);
}
void ConfirmTrade::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"tradePlayers", tradePlayers);
}
///////////////////////////////////////////////////////////////////////////
///ConfirmTrade //
// DropBankItem
// //////////////////////////////////////////////////////////////////////////
const wchar_t* DropBankItem::TypeName = L"DropBankItem";
const HashType DropBankItem::TypeHash =
StringUtil::Hash(DropBankItem::TypeName);
void DropBankItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"position", position);
}
void DropBankItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"position", position);
}
///////////////////////////////////////////////////////////////////////////
///DropBankItem //
// BankMoneyIn
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* BankMoneyIn::TypeName = L"BankMoneyIn";
const HashType BankMoneyIn::TypeHash =
StringUtil::Hash(BankMoneyIn::TypeName);
void BankMoneyIn::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"BankMoney", BankMoney);
out.WriteEnum(L"Result", Result);
}
void BankMoneyIn::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"BankMoney", BankMoney);
in.ReadEnum(L"Result", Result);
}
////////////////////////////////////////////////////////////////////////////
///BankMoneyIn //
// BankMoneyOut
// ///////////////////////////////////////////////////////////////////////////
const wchar_t* BankMoneyOut::TypeName = L"BankMoneyOut";
const HashType BankMoneyOut::TypeHash =
StringUtil::Hash(BankMoneyOut::TypeName);
void BankMoneyOut::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"BankMoney", BankMoney);
out.WriteEnum(L"Result", Result);
}
void BankMoneyOut::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"BankMoney", BankMoney);
in.ReadEnum(L"Result", Result);
}
///////////////////////////////////////////////////////////////////////////
///BankMoneyOut //
// QuickSlot
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* QuickSlot::TypeName = L"QuickSlot";
const HashType QuickSlot::TypeHash =
StringUtil::Hash(QuickSlot::TypeName);
void QuickSlot::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"number", number);
out.Write(L"id", id);
out.Write(L"isskill", isskill);
out.Write(L"instanceEx", instanceEx);
}
void QuickSlot::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"number", number);
in.Read(L"id", id);
in.Read(L"isskill", isskill);
in.Read(L"instanceEx", instanceEx);
};
/////////////////////////////////////////////////////////////////////////////
///QuickSlot //
// Identify
// ///////////////////////////////////////////////////////////////////////////////
const wchar_t* Identify::TypeName = L"Identify";
const HashType Identify::TypeHash =
StringUtil::Hash(Identify::TypeName);
void Identify::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
}
void Identify::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
}
///////////////////////////////////////////////////////////////////////////////
///Identify //
// Reinforce
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* Reinforce::TypeName = L"Reinforce";
const HashType Reinforce::TypeHash =
StringUtil::Hash(Reinforce::TypeName);
void Reinforce::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
}
void Reinforce::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
}
//////////////////////////////////////////////////////////////////////////////
///Reinforce //
// NoticeSuccessHighLevelReinforcement
// ////////////////////////////////////////////////////
const wchar_t* NoticeSuccessHighLevelReinforcement::TypeName =
L"NoticeSuccessHighLevelReinforcement";
const HashType NoticeSuccessHighLevelReinforcement::TypeHash =
StringUtil::Hash(NoticeSuccessHighLevelReinforcement::TypeName);
void NoticeSuccessHighLevelReinforcement::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CharacterName", CharacterName);
out.Write(L"ItemName", ItemName);
out.Write(L"Level", Level);
}
void NoticeSuccessHighLevelReinforcement::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CharacterName", CharacterName);
in.Read(L"ItemName", ItemName);
in.Read(L"Level", Level);
}
/////////////////////////////////////////////////////
///NoticeSuccessHighLevelReinforcement //
// NoticeSuccessHighLevelLightReinforcement
// ////////////////////////////////////////////////////
const wchar_t* NoticeSuccessHighLevelLightReinforcement::TypeName =
L"NoticeSuccessHighLevelLightReinforcement";
const HashType NoticeSuccessHighLevelLightReinforcement::TypeHash =
StringUtil::Hash(NoticeSuccessHighLevelLightReinforcement::TypeName);
void NoticeSuccessHighLevelLightReinforcement::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CharacterName", CharacterName);
out.Write(L"ItemName", ItemName);
out.Write(L"Level", Level);
}
void NoticeSuccessHighLevelLightReinforcement::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CharacterName", CharacterName);
in.Read(L"ItemName", ItemName);
in.Read(L"Level", Level);
}
/////////////////////////////////////////////////////
///NoticeSuccessHighLevelLightReinforcement //
// LightReinforce
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* LightReinforce::TypeName = L"LightReinforce";
const HashType LightReinforce::TypeHash =
StringUtil::Hash(LightReinforce::TypeName);
void LightReinforce::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
}
void LightReinforce::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
}
/////////////////////////////////////////////////////////////////////////////////
///LightReinforce //
// AttachMagic
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* AttachMagic::TypeName = L"AttachMagic";
const HashType AttachMagic::TypeHash =
StringUtil::Hash(AttachMagic::TypeName);
void AttachMagic::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"Instance", Instance);
}
void AttachMagic::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"Instance", Instance);
}
////////////////////////////////////////////////////////////////////////////
///AttachMagic //
// Extract
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* Extract::TypeName = L"Extract";
const HashType Extract::TypeHash =
StringUtil::Hash(Extract::TypeName);
void Extract::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"Count", Count);
out.WriteEnum(L"Result", Result);
}
void Extract::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"Count", Count);
in.ReadEnum(L"Result", Result);
}
////////////////////////////////////////////////////////////////////////////////
///Extract //
// Alchemy
// ////////////////////////////////////////////////////////////////////////////////
const wchar_t* Alchemy::TypeName = L"Alchemy";
const HashType Alchemy::TypeHash =
StringUtil::Hash(Alchemy::TypeName);
void Alchemy::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Products", Products);
out.WriteEnum(L"Result", Result);
}
void Alchemy::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Products", Products);
in.ReadEnum(L"Result", Result);
}
////////////////////////////////////////////////////////////////////////////////
///Alchemy //
// RestoreBelonging
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* RestoreBelonging::TypeName = L"RestoreBelonging";
const HashType RestoreBelonging::TypeHash =
StringUtil::Hash(RestoreBelonging::TypeName);
void RestoreBelonging::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
}
void RestoreBelonging::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
}
/////////////////////////////////////////////////////////////////////////////////
///RestoreBelonging //
// RecoverReinforcement
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* RecoverReinforcement::TypeName = L"RecoverReinforcement";
const HashType RecoverReinforcement::TypeHash =
StringUtil::Hash(RecoverReinforcement::TypeName);
void RecoverReinforcement::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
out.WriteEnum(L"Result", Result);
}
void RecoverReinforcement::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
in.ReadEnum(L"Result", Result);
}
/////////////////////////////////////////////////////////////////////////////////
///RecoverReinforcement //
// RecoverLightReinforcement
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* RecoverLightReinforcement::TypeName =
L"RecoverLightReinforcement";
const HashType RecoverLightReinforcement::TypeHash =
StringUtil::Hash(RecoverLightReinforcement::TypeName);
void RecoverLightReinforcement::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
out.WriteEnum(L"Result", Result);
}
void RecoverLightReinforcement::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
in.ReadEnum(L"Result", Result);
}
/////////////////////////////////////////////////////////////////////////////////
///RecoverLightReinforcement //
// ResetIndentification
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* ResetIndentification::TypeName = L"ResetIndentification";
const HashType ResetIndentification::TypeHash =
StringUtil::Hash(ResetIndentification::TypeName);
void ResetIndentification::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Position", Position);
out.Write(L"ItemHash", ItemHash);
out.Write(L"instanceEx", instanceEx);
out.WriteEnum(L"Result", Result);
}
void ResetIndentification::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Position", Position);
in.Read(L"ItemHash", ItemHash);
in.Read(L"instanceEx", instanceEx);
in.ReadEnum(L"Result", Result);
}
/////////////////////////////////////////////////////////////////////////////////
///ResetIndentification //
// Terminate
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* Terminate::TypeName = L"Terminate";
const HashType Terminate::TypeHash =
StringUtil::Hash(Terminate::TypeName);
void Terminate::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Terminate::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////////
///Terminate //
// ListCashItems
// //////////////////////////////////////////////////////////////////////////
const wchar_t* ListCashItems::TypeName = L"ListCashItems";
const HashType ListCashItems::TypeHash =
StringUtil::Hash(ListCashItems::TypeName);
void ListCashItems::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Total", Total);
out.Write(L"Items", Items);
}
void ListCashItems::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Total", Total);
in.Read(L"Items", Items);
}
//////////////////////////////////////////////////////////////////////////
///ListCashItems //
// PurchaseCashItem
// //////////////////////////////////////////////////////////////////////////
const wchar_t* PurchaseCashItem::TypeName = L"PurchaseCashItem";
const HashType PurchaseCashItem::TypeHash =
StringUtil::Hash(PurchaseCashItem::TypeName);
void PurchaseCashItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void PurchaseCashItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////
///PurchaseCashItem //
// CashItemMove
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* CashItemMove::TypeName = L"CashItemMove";
const HashType CashItemMove::TypeHash =
StringUtil::Hash(CashItemMove::TypeName);
void CashItemMove::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
if (Result != Ok) return;
out.Write(L"Items", Items);
}
void CashItemMove::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
if (Result != Ok) return;
in.Read(L"Items", Items);
}
//////////////////////////////////////////////////////////////////////////////
///CashItemMove //
// CashItemRefund
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* CashItemRefund::TypeName = L"CashItemRefund";
const HashType CashItemRefund::TypeHash =
StringUtil::Hash(CashItemRefund::TypeName);
void CashItemRefund::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void CashItemRefund::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
//////////////////////////////////////////////////////////////////////////////
///CashItemRefund //
// CashItemView
// //////////////////////////////////////////////////////////////////////////////
const wchar_t* CashItemView::TypeName = L"CashItemView";
const HashType CashItemView::TypeHash =
StringUtil::Hash(CashItemView::TypeName);
void CashItemView::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"userlist", userlist);
}
void CashItemView::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"userlist", userlist);
}
//////////////////////////////////////////////////////////////////////////////
///CashItemView //
// BagStates
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* BagStates::TypeName = L"BagStates";
const HashType BagStates::TypeHash =
StringUtil::Hash(BagStates::TypeName);
void BagStates::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Bags", Bags);
out.Write(L"BankBags", BankBags);
}
void BagStates::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Bags", Bags);
in.Read(L"BankBags", BankBags);
}
/////////////////////////////////////////////////////////////////////////////////
///BagStates //
// ChangedBagStates
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* ChangedBagStates::TypeName = L"ChangedBagStates";
const HashType ChangedBagStates::TypeHash =
StringUtil::Hash(ChangedBagStates::TypeName);
void ChangedBagStates::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Bags", Bags);
out.Write(L"BankBags", BankBags);
}
void ChangedBagStates::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Bags", Bags);
in.Read(L"BankBags", BankBags);
}
/////////////////////////////////////////////////////////////////////////////////
///ChangedBagStates //
// ChangeBagState
// ////////////////////////////////////////////////////////////////////////////
const wchar_t* ChangeBagState::TypeName = L"ChangeBagState";
const HashType ChangeBagState::TypeHash =
StringUtil::Hash(ChangeBagState::TypeName);
void ChangeBagState::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"IsBank", IsBank);
out.Write(L"Bag", Bag);
}
void ChangeBagState::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"IsBank", IsBank);
in.Read(L"Bag", Bag);
}
////////////////////////////////////////////////////////////////////////////
///ChangeBagState //
// Pause
// //////////////////////////////////////////////////////////////////////////////////
const wchar_t* Pause::TypeName = L"Pause";
const HashType Pause::TypeHash = StringUtil::Hash(Pause::TypeName);
void Pause::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Paused", Paused);
}
void Pause::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Paused", Paused);
}
//////////////////////////////////////////////////////////////////////////////////
///Pause //
// CharacterSlot
// //////////////////////////////////////////////////////////////////////////
const wchar_t* CharacterSlot::TypeName = L"CharacterSlot";
const HashType CharacterSlot::TypeHash =
StringUtil::Hash(CharacterSlot::TypeName);
void CharacterSlot::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"NumberOfSlots", NumberOfSlots);
}
void CharacterSlot::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"NumberOfSlots", NumberOfSlots);
}
//////////////////////////////////////////////////////////////////////////
///CharacterSlot //
// AcquireCharacterLicense
// ////////////////////////////////////////////////////////////////
const wchar_t* AcquireCharacterLicense::TypeName = L"AcquireCharacterLicense";
const HashType AcquireCharacterLicense::TypeHash =
StringUtil::Hash(AcquireCharacterLicense::TypeName);
void AcquireCharacterLicense::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", result);
out.Write(L"ByItem", ByItem);
out.WriteEnum(L"CharacterClass", CharacterClass);
}
void AcquireCharacterLicense::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", result);
in.Read(L"ByItem", ByItem, false);
in.ReadEnum(L"CharacterClass", CharacterClass,
Constants::ClassType::AnyClassType);
}
////////////////////////////////////////////////////////////////
///AcquireCharacterLicense //
const wchar_t* Tame::TypeName = L"Tame";
const HashType Tame::TypeHash = StringUtil::Hash(Tame::TypeName);
void Tame::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"OwnerSerial", OwnerSerial);
out.Write(L"TamedSerial", TamedSerial);
out.WriteEnum(L"FamiliarType", FamiliarType);
out.Write(L"TamedName", TamedName);
}
void Tame::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"OwnerSerial", OwnerSerial);
in.Read(L"TamedSerial", TamedSerial);
in.ReadEnum(L"FamiliarType", FamiliarType);
in.Read(L"TamedName", TamedName);
}
const wchar_t* PetTame::TypeName = L"PetTame";
const HashType PetTame::TypeHash =
StringUtil::Hash(PetTame::TypeName);
void PetTame::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"OwnerSerial", OwnerSerial);
out.Write(L"TamedSerial", TamedSerial);
out.WriteEnum(L"FamiliarType", FamiliarType);
out.Write(L"TamedName", TamedName);
out.Write(L"PetInfo", PetInfo);
out.Write(L"Equipments", Equipments);
}
void PetTame::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"OwnerSerial", OwnerSerial);
in.Read(L"TamedSerial", TamedSerial);
in.ReadEnum(L"FamiliarType", FamiliarType);
in.Read(L"TamedName", TamedName);
in.Read(L"PetInfo", PetInfo);
in.Read(L"Equipments", Equipments);
}
const wchar_t* CheckJoinToSecretStage::TypeName = L"CheckJoinToSecretStage";
const HashType CheckJoinToSecretStage::TypeHash =
StringUtil::Hash(CheckJoinToSecretStage::TypeName);
void CheckJoinToSecretStage::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void CheckJoinToSecretStage::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
// Random
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* Random::TypeName = L"Random";
const HashType Random::TypeHash = StringUtil::Hash(Random::TypeName);
void Random::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"RandomName", RandomName);
out.Write(L"MinValue", MinValue);
out.Write(L"MaxValue", MaxValue);
out.Write(L"RandomValue", RandomValue);
}
void Random::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"RandomName", RandomName);
in.Read(L"MinValue", MinValue);
in.Read(L"MaxValue", MaxValue);
in.Read(L"RandomValue", RandomValue);
}
/////////////////////////////////////////////////////////////////////////////////
///Random //
// Upgrade
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* Upgrade::TypeName = L"Upgrade";
const HashType Upgrade::TypeHash =
StringUtil::Hash(Upgrade::TypeName);
void Upgrade::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Upgrade::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
/////////////////////////////////////////////////////////////////////////////////
///Upgrade //
// Rename
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* Rename::TypeName = L"Rename";
const HashType Rename::TypeHash = StringUtil::Hash(Rename::TypeName);
void Rename::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"TargetType", TargetType);
out.WriteEnum(L"Result", Result);
}
void Rename::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"TargetType", TargetType);
in.ReadEnum(L"Result", Result);
}
/////////////////////////////////////////////////////////////////////////////////
///Rename //
// ChangeBaseExpFactor
// /////////////////////////////////////////////////////////////////////////////////
const wchar_t* ChangeBaseExpFactor::TypeName = L"ChangeBaseExpFactor";
const HashType ChangeBaseExpFactor::TypeHash =
StringUtil::Hash(ChangeBaseExpFactor::TypeName);
void ChangeBaseExpFactor::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ExpFactor", ExpFactor);
}
void ChangeBaseExpFactor::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ExpFactor", ExpFactor);
}
/////////////////////////////////////////////////////////////////////////////////
///ChangeBaseExpFactor //
/* AllMGuild
* *********************************************************************************/
const wchar_t* AllMGuild::SetPlayer::TypeName = L"AllMGuild::SetPlayer";
const HashType AllMGuild::SetPlayer::TypeHash =
StringUtil::Hash(AllMGuild::SetPlayer::TypeName);
void AllMGuild::SetPlayer::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Serial", Serial);
out.Write(L"GuildInfo", GuildInfo);
}
void AllMGuild::SetPlayer::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Serial", Serial);
in.Read(L"GuildInfo", GuildInfo);
}
const wchar_t* AllMGuild::Create::TypeName = L"AllMGuild::Create";
const HashType AllMGuild::Create::TypeHash =
StringUtil::Hash(AllMGuild::Create::TypeName);
void AllMGuild::Create::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
if (Result != Ok) return;
out.Write(L"guildId", guildId);
}
void AllMGuild::Create::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
if (Result != Ok) return;
in.Read(L"guildId", guildId);
}
const wchar_t* AllMGuild::Invite::TypeName = L"AllMGuild::Invite";
const HashType AllMGuild::Invite::TypeHash =
StringUtil::Hash(AllMGuild::Invite::TypeName);
void AllMGuild::Invite::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::Invite::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::InviteReply::TypeName = L"AllMGuild::InviteReply";
const HashType AllMGuild::InviteReply::TypeHash =
StringUtil::Hash(AllMGuild::InviteReply::TypeName);
void AllMGuild::InviteReply::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"TargetCharacterName", TargetCharacterName);
}
void AllMGuild::InviteReply::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"TargetCharacterName", TargetCharacterName);
}
const wchar_t* AllMGuild::InvitedFrom::TypeName = L"AllMGuild::InvitedFrom";
const HashType AllMGuild::InvitedFrom::TypeHash =
StringUtil::Hash(AllMGuild::InvitedFrom::TypeName);
void AllMGuild::InvitedFrom::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"GuildId", GuildId);
out.Write(L"GuildName", GuildName);
out.Write(L"InvitorCharacterName", InvitorCharacterName);
}
void AllMGuild::InvitedFrom::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"GuildId", GuildId);
in.Read(L"GuildName", GuildName);
in.Read(L"InvitorCharacterName", InvitorCharacterName);
}
const wchar_t* AllMGuild::Join::TypeName = L"AllMGuild::Join";
const HashType AllMGuild::Join::TypeHash =
StringUtil::Hash(AllMGuild::Join::TypeName);
void AllMGuild::Join::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
if (Result != Ok) return;
out.Write(L"guildId", guildId);
}
void AllMGuild::Join::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
if (Result != Ok) return;
in.Read(L"guildId", guildId);
}
const wchar_t* AllMGuild::Kick::TypeName = L"AllMGuild::Kick";
const HashType AllMGuild::Kick::TypeHash =
StringUtil::Hash(AllMGuild::Kick::TypeName);
void AllMGuild::Kick::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::Kick::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::Leave::TypeName = L"AllMGuild::Leave";
const HashType AllMGuild::Leave::TypeHash =
StringUtil::Hash(AllMGuild::Leave::TypeName);
void AllMGuild::Leave::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"Serial", Serial);
out.Write(L"Kicked", Kicked);
}
void AllMGuild::Leave::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"Serial", Serial);
in.Read(L"Kicked", Kicked);
}
const wchar_t* AllMGuild::ListMembers::TypeName = L"AllMGuild::ListMembers";
const HashType AllMGuild::ListMembers::TypeHash =
StringUtil::Hash(AllMGuild::ListMembers::TypeName);
void AllMGuild::ListMembers::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"Members", Members);
out.Write(L"isSeparate", isSeparate); // 3.1 by Robotex
}
void AllMGuild::ListMembers::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"Members", Members);
in.Read(L"isSeparate", isSeparate); // 3.1 by Robotex
}
const wchar_t* AllMGuild::Remove::TypeName = L"AllMGuild::Remove";
const HashType AllMGuild::Remove::TypeHash =
StringUtil::Hash(AllMGuild::Remove::TypeName);
void AllMGuild::Remove::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::Remove::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::ValidateName::TypeName = L"AllMGuild::ValidateName";
const HashType AllMGuild::ValidateName::TypeHash =
StringUtil::Hash(AllMGuild::ValidateName::TypeName);
void AllMGuild::ValidateName::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::ValidateName::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::GuildRankList::TypeName = L"AllMGuild::GuildRankList";
const HashType AllMGuild::GuildRankList::TypeHash =
StringUtil::Hash(AllMGuild::GuildRankList::TypeName);
void AllMGuild::GuildRankList::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"Result", RankList);
}
void AllMGuild::GuildRankList::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"Result", RankList);
}
const wchar_t* AllMGuild::ValidateAlias::TypeName = L"AllMGuild::ValidateAlias";
const HashType AllMGuild::ValidateAlias::TypeHash =
StringUtil::Hash(AllMGuild::ValidateAlias::TypeName);
void AllMGuild::ValidateAlias::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::ValidateAlias::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::AddedGuildExp::TypeName = L"AllMGuild::AddedGuildExp";
const HashType AllMGuild::AddedGuildExp::TypeHash =
StringUtil::Hash(AllMGuild::AddedGuildExp::TypeName);
void AllMGuild::AddedGuildExp::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"GuildLevel", GuildLevel);
out.Write(L"GuildExp", GuildExp);
out.Write(L"ChangedLevel", ChangedLevel);
out.Write(L"IsByItem", IsByItem);
out.Write(L"PlayTime", PlayTime);
out.Write(L"StartedTimeToPlay", StartedTimeToPlay);
}
void AllMGuild::AddedGuildExp::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"GuildLevel", GuildLevel);
in.Read(L"GuildExp", GuildExp);
in.Read(L"ChangedLevel", ChangedLevel);
in.Read(L"IsByItem", IsByItem);
in.Read(L"PlayTime", PlayTime);
in.Read(L"StartedTimeToPlay", StartedTimeToPlay);
}
const wchar_t* AllMGuild::AddedRankingPoint::TypeName =
L"AllMGuild::AddedRankingPoint"; /// by kpongky( 09.07.08 ) BMS 6705
const HashType AllMGuild::AddedRankingPoint::TypeHash =
StringUtil::Hash(AllMGuild::AddedRankingPoint::TypeName);
void AllMGuild::AddedRankingPoint::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"OldRankingPoint", OldRankingPoint);
out.Write(L"NewRankingPoint", NewRankingPoint);
}
void AllMGuild::AddedRankingPoint::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"OldRankingPoint", OldRankingPoint);
in.Read(L"NewRankingPoint", NewRankingPoint);
}
const wchar_t* AllMGuild::AddedGuildMaintenancePoint::TypeName =
L"AllMGuild::AddedGuildMaintenancePoint";
const HashType AllMGuild::AddedGuildMaintenancePoint::TypeHash =
StringUtil::Hash(AllMGuild::AddedGuildMaintenancePoint::TypeName);
void AllMGuild::AddedGuildMaintenancePoint::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"GuildMaintenacePoint", GuildMaintenacePoint);
out.Write(L"IncreasePoint", IncreasePoint);
out.Write(L"ShopOpenDate", ShopOpenDate);
out.Write(L"ShopCloseDate", ShopCloseDate);
}
void AllMGuild::AddedGuildMaintenancePoint::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"GuildMaintenacePoint", GuildMaintenacePoint);
in.Read(L"IncreasePoint", IncreasePoint);
in.Read(L"ShopOpenDate", ShopOpenDate);
in.Read(L"ShopCloseDate", ShopCloseDate);
}
const wchar_t* AllMGuild::GuildShopItemList::TypeName =
L"AllMGuild::GuildShopItemList";
const HashType AllMGuild::GuildShopItemList::TypeHash =
StringUtil::Hash(AllMGuild::GuildShopItemList::TypeName);
void AllMGuild::GuildShopItemList::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"GuildShopItems", GuildShopItems);
}
void AllMGuild::GuildShopItemList::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"GuildShopItems", GuildShopItems);
}
const wchar_t* AllMGuild::AddedGuildShopItem::TypeName =
L"AllMGuild::AddedGuildShopItem";
const HashType AllMGuild::AddedGuildShopItem::TypeHash =
StringUtil::Hash(AllMGuild::AddedGuildShopItem::TypeName);
void AllMGuild::AddedGuildShopItem::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Item", Item);
}
void AllMGuild::AddedGuildShopItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Item", Item);
}
const wchar_t* AllMGuild::AddExpFactorByItem::TypeName =
L"AllMGuild::AddExpFactorByItem";
const HashType AllMGuild::AddExpFactorByItem::TypeHash =
StringUtil::Hash(AllMGuild::AddExpFactorByItem::TypeName);
void AllMGuild::AddExpFactorByItem::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ExpFactor", ExpFactor);
}
void AllMGuild::AddExpFactorByItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ExpFactor", ExpFactor);
}
const wchar_t* AllMGuild::TaxGained::TypeName = L"AllMGuild::TaxGained";
const HashType AllMGuild::TaxGained::TypeHash =
StringUtil::Hash(AllMGuild::TaxGained::TypeName);
void AllMGuild::TaxGained::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Tax", Tax);
out.Write(L"TaxPayDate", TaxPayDate);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::TaxGained::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Tax", Tax);
in.Read(L"TaxPayDate", TaxPayDate);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::TaxChanged::TypeName = L"AllMGuild::TaxChanged";
const HashType AllMGuild::TaxChanged::TypeHash =
StringUtil::Hash(AllMGuild::TaxChanged::TypeName);
void AllMGuild::TaxChanged::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Tax", Tax);
}
void AllMGuild::TaxChanged::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Tax", Tax);
}
const wchar_t* AllMGuild::MessageChange::TypeName = L"AllMGuild::MessageChange";
const HashType AllMGuild::MessageChange::TypeHash =
StringUtil::Hash(AllMGuild::MessageChange::TypeName);
void AllMGuild::MessageChange::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void AllMGuild::MessageChange::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* AllMGuild::ChangeGrade::TypeName = L"AllMGuild::ChangeGrade";
const HashType AllMGuild::ChangeGrade::TypeHash =
StringUtil::Hash(AllMGuild::ChangeGrade::TypeName);
void AllMGuild::ChangeGrade::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"TargetCharacterName", TargetCharacterName);
out.Write(L"Grade", Grade);
}
void AllMGuild::ChangeGrade::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"TargetCharacterName", TargetCharacterName);
in.Read(L"Grade", Grade);
}
const wchar_t* AllMGuild::ChangeGradeName::TypeName =
L"AllMGuild::ChangeGradeName";
const HashType AllMGuild::ChangeGradeName::TypeHash =
StringUtil::Hash(AllMGuild::ChangeGradeName::TypeName);
void AllMGuild::ChangeGradeName::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"TargetGrade", TargetGrade);
out.Write(L"TargetGradeName", TargetGradeName);
}
void AllMGuild::ChangeGradeName::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"TargetGrade", TargetGrade);
in.Read(L"TargetGradeName", TargetGradeName);
}
const wchar_t* AllMGuild::ChangeGradeAuth::TypeName =
L"AllMGuild::ChangeGradeAuth";
const HashType AllMGuild::ChangeGradeAuth::TypeHash =
StringUtil::Hash(AllMGuild::ChangeGradeAuth::TypeName);
void AllMGuild::ChangeGradeAuth::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"TargetGrade", TargetGrade);
out.Write(L"Authority", Authority);
}
void AllMGuild::ChangeGradeAuth::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"TargetGrade", TargetGrade);
in.Read(L"Authority", Authority);
}
const wchar_t* AllMGuild::ChangeGuildMaster::TypeName =
L"AllMGuild::ChangeGuildMaster";
const HashType AllMGuild::ChangeGuildMaster::TypeHash =
StringUtil::Hash(AllMGuild::ChangeGuildMaster::TypeName);
void AllMGuild::ChangeGuildMaster::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"TargetCharacterName", TargetCharacterName);
}
void AllMGuild::ChangeGuildMaster::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"TargetCharacterName", TargetCharacterName);
}
const wchar_t* AllMGuild::LevelUp::TypeName = L"AllMGuild::LevelUp";
const HashType AllMGuild::LevelUp::TypeHash =
StringUtil::Hash(AllMGuild::LevelUp::TypeName);
void AllMGuild::LevelUp::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"GuildId", GuildId);
out.Write(L"GuildLevel", Level);
}
void AllMGuild::LevelUp::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"GuildId", GuildId);
in.Read(L"GuildLevel", Level);
}
/*********************************************************************************
* AllMGuild */
// 3.1 by ultimate
const wchar_t* Compose::TypeName = L"Compose";
const HashType Compose::TypeHash =
StringUtil::Hash(Compose::TypeName);
void Compose::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"Type", Type);
out.Write(L"GradeState", GradeState);
out.Write(L"ItemSlot", ItemSlot);
};
void Compose::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"Type", Type);
in.Read(L"GradeState", GradeState);
in.Read(L"ItemSlot", ItemSlot);
}
/* Quest
* *********************************************************************************/
const wchar_t* Quest::WorkingList::TypeName = L"Quest::WorkingList";
const HashType Quest::WorkingList::TypeHash =
StringUtil::Hash(Quest::WorkingList::TypeName);
void Quest::WorkingList::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Quests", Quests);
};
void Quest::WorkingList::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Quests", Quests);
}
const wchar_t* Quest::CompletedList::TypeName = L"Quest::CompletedList";
const HashType Quest::CompletedList::TypeHash =
StringUtil::Hash(Quest::CompletedList::TypeName);
void Quest::CompletedList::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Quests", Quests);
};
void Quest::CompletedList::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Quests", Quests);
}
const wchar_t* Quest::CompletedCount::TypeName = L"Quest::CompletedCount";
const HashType Quest::CompletedCount::TypeHash =
StringUtil::Hash(Quest::CompletedCount::TypeName);
void Quest::CompletedCount::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.Write(L"Count", Count);
};
void Quest::CompletedCount::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.Read(L"Count", Count);
}
const wchar_t* Quest::Offer::TypeName = L"Quest::Offer";
const HashType Quest::Offer::TypeHash =
StringUtil::Hash(Quest::Offer::TypeName);
void Quest::Offer::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
};
void Quest::Offer::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
}
const wchar_t* Quest::Error::TypeName = L"Quest::Error";
const HashType Quest::Error::TypeHash =
StringUtil::Hash(Quest::Error::TypeName);
void Quest::Error::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.WriteEnum(L"Result", Result);
};
void Quest::Error::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Quest::Accept::TypeName = L"Quest::Accept";
const HashType Quest::Accept::TypeHash =
StringUtil::Hash(Quest::Accept::TypeName);
void Quest::Accept::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.Write(L"NewState", NewState);
out.Write(L"ExpiredDate", ExpiredDate);
};
void Quest::Accept::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.Read(L"NewState", NewState);
in.Read(L"ExpiredDate", ExpiredDate);
}
const wchar_t* Quest::ChangeState::TypeName = L"Quest::ChangeState";
const HashType Quest::ChangeState::TypeHash =
StringUtil::Hash(Quest::ChangeState::TypeName);
void Quest::ChangeState::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.Write(L"NewState", NewState);
out.Write(L"Parameter", Parameter);
out.Write(L"CompletedCount", CompletedCount);
};
void Quest::ChangeState::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.Read(L"NewState", NewState);
in.Read(L"Parameter", Parameter);
in.Read(L"CompletedCount", CompletedCount);
}
const wchar_t* Quest::Drop::TypeName = L"Quest::Drop";
const HashType Quest::Drop::TypeHash =
StringUtil::Hash(Quest::Drop::TypeName);
void Quest::Drop::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
};
void Quest::Drop::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
}
const wchar_t* Quest::Update::TypeName = L"Quest::Update";
const HashType Quest::Update::TypeHash =
StringUtil::Hash(Quest::Update::TypeName);
void Quest::Update::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Quest", Quest);
};
void Quest::Update::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Quest", Quest);
}
const wchar_t* Quest::ActivityItem::TypeName = L"Quest::ActivityItem";
const HashType Quest::ActivityItem::TypeHash =
StringUtil::Hash(Quest::ActivityItem::TypeName);
void Quest::ActivityItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
};
void Quest::ActivityItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
}
const wchar_t* Quest::ShowDetailWindow::TypeName = L"Quest::ShowDetailWindow";
const HashType Quest::ShowDetailWindow::TypeHash =
StringUtil::Hash(Quest::ShowDetailWindow::TypeName);
void Quest::ShowDetailWindow::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.WriteEnum(L"Result", Result);
};
void Quest::ShowDetailWindow::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Quest::Share::TypeName = L"Quest::Share";
const HashType Quest::Share::TypeHash =
StringUtil::Hash(Quest::Share::TypeName);
void Quest::Share::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.Write(L"ShareOwner", ShareOwner);
};
void Quest::Share::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.Read(L"ShareOwner", ShareOwner);
}
const wchar_t* Quest::ShareResult::TypeName = L"Quest::ShareResult";
const HashType Quest::ShareResult::TypeHash =
StringUtil::Hash(Quest::ShareResult::TypeName);
void Quest::ShareResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"QuestHash", QuestHash);
out.Write(L"SuccessPlayerCount", SuccessPlayerCount);
};
void Quest::ShareResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"QuestHash", QuestHash);
in.Read(L"SuccessPlayerCount", SuccessPlayerCount);
}
/*********************************************************************************
* Quest */
/* QuestEvent
* *********************************************************************************/
const wchar_t* QuestEvent::EnableQuestEvent::TypeName =
L"QuestEvent::EnableQuestEvent";
const HashType QuestEvent::EnableQuestEvent::TypeHash =
StringUtil::Hash(QuestEvent::EnableQuestEvent::TypeName);
void QuestEvent::EnableQuestEvent::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"EventQuestID", EventQuestID);
out.Write(L"Enable", Enable);
out.Write(L"EventExplain", EventExplain);
};
void QuestEvent::EnableQuestEvent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"EventQuestID", EventQuestID);
in.Read(L"Enable", Enable);
in.Read(L"EventExplain", EventExplain);
}
const wchar_t* QuestEvent::NoticeQuestEvent::TypeName =
L"QuestEvent::NoticeQuestEvent";
const HashType QuestEvent::NoticeQuestEvent::TypeHash =
StringUtil::Hash(QuestEvent::NoticeQuestEvent::TypeName);
void QuestEvent::NoticeQuestEvent::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"EventNotice", EventNotice);
};
void QuestEvent::NoticeQuestEvent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"EventNotice", EventNotice);
}
/*********************************************************************************
* QuestEvent */
/* NpcDropEvent
* *********************************************************************************/
const wchar_t* NpcDropEvent::EnableNpcDropEvent::TypeName =
L"NpcDropEvent::EnableNpcDropEvent";
const HashType NpcDropEvent::EnableNpcDropEvent::TypeHash =
StringUtil::Hash(NpcDropEvent::EnableNpcDropEvent::TypeName);
void NpcDropEvent::EnableNpcDropEvent::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"EventID", EventID);
out.Write(L"Enable", Enable);
out.Write(L"EventExplain", EventExplain);
};
void NpcDropEvent::EnableNpcDropEvent::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"EventID", EventID);
in.Read(L"Enable", Enable);
in.Read(L"EventExplain", EventExplain);
}
/*********************************************************************************
* NpcDropEvent */
/* PlayerStore
* ***************************************************************************/
const wchar_t* PlayerStore::Open::TypeName = L"PlayerStore::Open";
const HashType PlayerStore::Open::TypeHash =
StringUtil::Hash(PlayerStore::Open::TypeName);
void PlayerStore::Open::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"StoreItemHash", StoreItemHash);
out.Write(L"Title", Title);
};
void PlayerStore::Open::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"StoreItemHash", StoreItemHash);
in.Read(L"Title", Title);
}
const wchar_t* PlayerStore::Close::TypeName = L"PlayerStore::Close";
const HashType PlayerStore::Close::TypeHash =
StringUtil::Hash(PlayerStore::Close::TypeName);
void PlayerStore::Close::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
};
void PlayerStore::Close::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
}
const wchar_t* PlayerStore::List::TypeName = L"PlayerStore::List";
const HashType PlayerStore::List::TypeHash =
StringUtil::Hash(PlayerStore::List::TypeName);
void PlayerStore::List::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"Slots", Slots);
out.Write(L"SlotsForPet", SlotsForPet);
};
void PlayerStore::List::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"Slots", Slots);
in.Read(L"SlotsForPet", SlotsForPet);
}
const wchar_t* PlayerStore::Buy::TypeName = L"PlayerStore::Buy";
const HashType PlayerStore::Buy::TypeHash =
StringUtil::Hash(PlayerStore::Buy::TypeName);
void PlayerStore::Buy::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
if (Result != Ok) return;
out.Write(L"Buyer", Buyer);
out.Write(L"Item", Item);
out.Write(L"Position", Position);
out.Write(L"CurrentMoney", CurrentMoney);
};
void PlayerStore::Buy::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
if (Result != Ok) return;
in.Read(L"Buyer", Buyer);
in.Read(L"Item", Item);
in.Read(L"Position", Position);
in.Read(L"CurrentMoney", CurrentMoney);
}
/***************************************************************************
* PlayerStore */
const wchar_t* Bank::List::TypeName = L"Bank::List";
const HashType Bank::List::TypeHash =
StringUtil::Hash(Bank::List::TypeName);
void Bank::List::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"BagNumber", BagNumber);
out.Write(L"Items", Items);
}
void Bank::List::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"BagNumber", BagNumber);
in.Read(L"Items", Items);
}
const wchar_t* Bank::Push::TypeName = L"Bank::Push";
const HashType Bank::Push::TypeHash =
StringUtil::Hash(Bank::Push::TypeName);
void Bank::Push::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceInventory", SourceInventory);
out.Write(L"TargetStorage", TargetStorage);
out.Write(L"Count", Count);
}
void Bank::Push::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceInventory", SourceInventory);
in.Read(L"TargetStorage", TargetStorage);
in.Read(L"Count", Count);
}
const wchar_t* Bank::Pop::TypeName = L"Bank::Pop";
const HashType Bank::Pop::TypeHash =
StringUtil::Hash(Bank::Pop::TypeName);
void Bank::Pop::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceStorage", SourceStorage);
out.Write(L"TargetInventory", TargetInventory);
out.Write(L"Count", Count);
}
void Bank::Pop::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceStorage", SourceStorage);
in.Read(L"TargetInventory", TargetInventory);
in.Read(L"Count", Count);
}
const wchar_t* Bank::SwapItemInStorage::TypeName = L"Bank::SwapItemInStorage";
const HashType Bank::SwapItemInStorage::TypeHash =
StringUtil::Hash(Bank::SwapItemInStorage::TypeName);
void Bank::SwapItemInStorage::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceStorage", SourceStorage);
out.Write(L"TargetStorage", TargetStorage);
out.Write(L"Count", Count);
}
void Bank::SwapItemInStorage::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceStorage", SourceStorage);
in.Read(L"TargetStorage", TargetStorage);
in.Read(L"Count", Count);
}
const wchar_t* Bank::Move::TypeName = L"Bank::Move";
const HashType Bank::Move::TypeHash =
StringUtil::Hash(Bank::Move::TypeName);
void Bank::Move::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceInventory", SourceInventory);
out.Write(L"TargetStorage", TargetStorage);
}
void Bank::Move::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceInventory", SourceInventory);
in.Read(L"TargetStorage", TargetStorage);
}
/*********************************************************************** Bank */
/* CashItemStorage
* ***********************************************************************/
void CashItemStorage::List::ItemUnit::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(L"CashItemStorage::List::ItemUnit");
out.Write(L"ItemSerial", ItemSerial);
out.Write(L"instanceEx", instanceEx); // 3.1 by ultimate
out.Write(L"ItemHash", ItemHash);
out.Write(L"StackedCount", StackedCount);
}
void CashItemStorage::List::ItemUnit::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(L"CashItemStorage::List::ItemUnit");
in.Read(L"ItemSerial", ItemSerial);
in.Read(L"instanceEx", instanceEx); // 3.1 by ultimate
in.Read(L"ItemHash", ItemHash);
in.Read(L"StackedCount", StackedCount);
}
const wchar_t* CashItemStorage::List::TypeName = L"CashItemStorage::List";
const HashType CashItemStorage::List::TypeHash =
StringUtil::Hash(CashItemStorage::List::TypeName);
void CashItemStorage::List::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PageIndex", PageIndex);
out.Write(L"Items", Items);
}
void CashItemStorage::List::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PageIndex", PageIndex);
in.Read(L"Items", Items);
}
const wchar_t* CashItemStorage::Push::TypeName = L"CashItemStorage::Push";
const HashType CashItemStorage::Push::TypeHash =
StringUtil::Hash(CashItemStorage::Push::TypeName);
void CashItemStorage::Push::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceInventory", SourceInventory);
out.Write(L"TargetStorage", TargetStorage);
}
void CashItemStorage::Push::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceInventory", SourceInventory);
in.Read(L"TargetStorage", TargetStorage);
}
const wchar_t* CashItemStorage::Pop::TypeName = L"CashItemStorage::Pop";
const HashType CashItemStorage::Pop::TypeHash =
StringUtil::Hash(CashItemStorage::Pop::TypeName);
void CashItemStorage::Pop::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceStorage", SourceStorage);
out.Write(L"TargetInventory", TargetInventory);
}
void CashItemStorage::Pop::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceStorage", SourceStorage);
in.Read(L"TargetInventory", TargetInventory);
}
const wchar_t* CashItemStorage::MoveItemInStorage::TypeName =
L"CashItemStorage::MoveItemInStorage";
const HashType CashItemStorage::MoveItemInStorage::TypeHash =
StringUtil::Hash(CashItemStorage::MoveItemInStorage::TypeName);
void CashItemStorage::MoveItemInStorage::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceStorage", SourceStorage);
out.Write(L"TargetStorage", TargetStorage);
}
void CashItemStorage::MoveItemInStorage::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceStorage", SourceStorage);
in.Read(L"TargetStorage", TargetStorage);
}
const wchar_t* CashItemStorage::Stack::TypeName = L"CashItemStorage::Stack";
const HashType CashItemStorage::Stack::TypeHash =
StringUtil::Hash(CashItemStorage::Stack::TypeName);
void CashItemStorage::Stack::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SourceInventory", SourceInventory);
out.Write(L"TargetStorage", TargetStorage);
out.Write(L"Count", Count);
}
void CashItemStorage::Stack::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SourceInventory", SourceInventory);
in.Read(L"TargetStorage", TargetStorage);
in.Read(L"Count", Count);
}
/***********************************************************************
* CashItemStorage */
const wchar_t* AskContinueStage::TypeName = L"AskContinueStage";
const HashType AskContinueStage::TypeHash =
StringUtil::Hash(AskContinueStage::TypeName);
void AskContinueStage::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
}
void AskContinueStage::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
}
const wchar_t* PvpMissionCleared::TypeName = L"PvpMissionCleared";
const HashType PvpMissionCleared::TypeHash =
StringUtil::Hash(PvpMissionCleared::TypeName);
void PvpMissionCleared::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"isWin", isWin);
out.WriteEnum(L"subInfo", subInfo);
}
void PvpMissionCleared::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"isWin", isWin);
in.ReadEnum(L"subInfo", subInfo);
}
/* Pvp
* ***********************************************************************************/
const wchar_t* Pvp::PlayerDie::TypeName = L"Pvp::PlayerDie";
const HashType Pvp::PlayerDie::TypeHash =
StringUtil::Hash(Pvp::PlayerDie::TypeName);
void Pvp::PlayerDie::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ObjectSerial", ObjectSerial);
out.Write(L"FromSerial", FromSerial);
}
void Pvp::PlayerDie::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ObjectSerial", ObjectSerial);
in.Read(L"FromSerial", FromSerial);
}
const wchar_t* Pvp::PlayerSave::TypeName = L"Pvp::PlayerSave";
const HashType Pvp::PlayerSave::TypeHash =
StringUtil::Hash(Pvp::PlayerSave::TypeName);
void Pvp::PlayerSave::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ObjectSerial", ObjectSerial);
out.Write(L"FromSerial", FromSerial);
}
void Pvp::PlayerSave::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ObjectSerial", ObjectSerial);
in.Read(L"FromSerial", FromSerial);
}
const wchar_t* Pvp::MatchResultInfo::TypeName = L"Pvp::MatchResultInfo";
const HashType Pvp::MatchResultInfo::TypeHash =
StringUtil::Hash(Pvp::MatchResultInfo::TypeName);
void Pvp::MatchResultInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"SerialDieCount", SerialDieCount);
out.Write(L"SerialkillCount", SerialKillCount);
}
void Pvp::MatchResultInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"SerialDieCount", SerialDieCount);
in.Read(L"SerialkillCount", SerialKillCount);
}
const wchar_t* Pvp::NotifySpectatorInOut::TypeName =
L"Pvp::NotifySpectatorInOut";
const HashType Pvp::NotifySpectatorInOut::TypeHash =
StringUtil::Hash(Pvp::NotifySpectatorInOut::TypeName);
void Pvp::NotifySpectatorInOut::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CharacterName", CharacterName);
out.Write(L"Entered", Entered);
}
void Pvp::NotifySpectatorInOut::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CharacterName", CharacterName);
in.Read(L"Entered", Entered);
}
const wchar_t* Pvp::NotifySpectators::TypeName = L"Pvp::NotifySpectators";
const HashType Pvp::NotifySpectators::TypeHash =
StringUtil::Hash(Pvp::NotifySpectators::TypeName);
void Pvp::NotifySpectators::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Spectators", Spectators);
}
void Pvp::NotifySpectators::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Spectators", Spectators);
}
const wchar_t* Pvp::BattleGroundInfo::TypeName = L"Pvp::BattleGroundInfo";
const HashType Pvp::BattleGroundInfo::TypeHash =
StringUtil::Hash(Pvp::BattleGroundInfo::TypeName);
void Pvp::BattleGroundInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Info", Info);
}
void Pvp::BattleGroundInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Info", Info);
}
const wchar_t* Pvp::NotifyBattleGroundInfo::TypeName =
L"Pvp::NotifyBattleGroundInfo";
const HashType Pvp::NotifyBattleGroundInfo::TypeHash =
StringUtil::Hash(Pvp::NotifyBattleGroundInfo::TypeName);
void Pvp::NotifyBattleGroundInfo::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"TeamlKillInfo", TeamlKillInfo);
out.Write(L"RemainTime", RemainTime);
}
void Pvp::NotifyBattleGroundInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"TeamlKillInfo", TeamlKillInfo);
in.Read(L"RemainTime", RemainTime);
}
const wchar_t* Pvp::PvpLeaveStage::TypeName = L"Pvp::PvpLeaveStage";
const HashType Pvp::PvpLeaveStage::TypeHash =
StringUtil::Hash(Pvp::PvpLeaveStage::TypeName);
void Pvp::PvpLeaveStage::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
}
void Pvp::PvpLeaveStage::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
}
/***********************************************************************************
* Pvp */
/* StylePoint
* ***********************************************************************************/
const wchar_t* StylePoint::ChangeState::TypeName = L"StylePoint::ChangeState";
const HashType StylePoint::ChangeState::TypeHash =
StringUtil::Hash(StylePoint::ChangeState::TypeName);
void StylePoint::ChangeState::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"State", State);
out.Write(L"CurrentPoint", CurrentPoint);
}
void StylePoint::ChangeState::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"State", State);
in.Read(L"CurrentPoint", CurrentPoint);
}
const wchar_t* StylePoint::ActionType::TypeName = L"StylePoint::ActionType";
const HashType StylePoint::ActionType::TypeHash =
StringUtil::Hash(StylePoint::ActionType::TypeName);
void StylePoint::ActionType::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Type", Type);
}
void StylePoint::ActionType::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Type", Type);
}
/***********************************************************************************
* StylePoint */
/* Dailyitem::ConnectedWeek
* ***********************************************************************/
const wchar_t* Dailyitem::ConnectedWeek::TypeName = L"Dailyitem::ConnectedWeek";
const HashType Dailyitem::ConnectedWeek::TypeHash =
StringUtil::Hash(Dailyitem::ConnectedWeek::TypeName);
void Dailyitem::ConnectedWeek::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Week", Week);
out.Write(L"ConnectedDate", ConnectedDate);
}
void Dailyitem::ConnectedWeek::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Week", Week);
in.Read(L"ConnectedDate", ConnectedDate);
}
/***********************************************************************
* Dailyitem::ConnectedWeek */
/* GameAddictsPrevent
* ***********************************************************************/
const wchar_t* GameAddictsPrevent::TypeName = L"GameAddictsPrevent";
const HashType GameAddictsPrevent::TypeHash =
StringUtil::Hash(GameAddictsPrevent::TypeName);
void GameAddictsPrevent::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"StackedPlayTimeInSec", StackedPlayTimeInSec);
}
void GameAddictsPrevent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"StackedPlayTimeInSec", StackedPlayTimeInSec);
}
/***********************************************************************
* GameAddictsPrevent */
/* Mail ***********************************************************************/
const wchar_t* Mail::RequestMailList::TypeName = L"Mail::RequestMailList";
const HashType Mail::RequestMailList::TypeHash =
StringUtil::Hash(Mail::RequestMailList::TypeName);
void Mail::RequestMailList::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"MailHeaderList", MailHeaderList);
out.WriteEnum(L"Result", Result);
}
void Mail::RequestMailList::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"MailHeaderList", MailHeaderList);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Mail::ReadMail::TypeName = L"Mail::ReadMail";
const HashType Mail::ReadMail::TypeHash =
StringUtil::Hash(Mail::ReadMail::TypeName);
void Mail::ReadMail::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"MailContents", MailContents);
out.WriteEnum(L"Result", Result);
}
void Mail::ReadMail::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"MailContents", MailContents);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Mail::SendMail::TypeName = L"Mail::SendMail";
const HashType Mail::SendMail::TypeHash =
StringUtil::Hash(Mail::SendMail::TypeName);
void Mail::SendMail::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Mail::SendMail::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Mail::DisposeMail::TypeName = L"Mail::DisposeMail";
const HashType Mail::DisposeMail::TypeHash =
StringUtil::Hash(Mail::DisposeMail::TypeName);
void Mail::DisposeMail::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Index", Index);
out.WriteEnum(L"Result", Result);
}
void Mail::DisposeMail::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Index", Index);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Mail::DisposeReadMails::TypeName = L"Mail::DisposeReadMails";
const HashType Mail::DisposeReadMails::TypeHash =
StringUtil::Hash(Mail::DisposeReadMails::TypeName);
void Mail::DisposeReadMails::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Indexes", Indexes);
out.WriteEnum(L"Result", Result);
}
void Mail::DisposeReadMails::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Indexes", Indexes);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Mail::MailAlarmed::TypeName = L"Mail::MailAlarmed";
const HashType Mail::MailAlarmed::TypeHash =
StringUtil::Hash(Mail::MailAlarmed::TypeName);
void Mail::MailAlarmed::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Types", Types);
}
void Mail::MailAlarmed::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Types", Types, Normal);
}
const wchar_t* Mail::RetrieveAttached::TypeName = L"Mail::RetrieveAttached";
const HashType Mail::RetrieveAttached::TypeHash =
StringUtil::Hash(Mail::RetrieveAttached::TypeName);
void Mail::RetrieveAttached::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Index", Index);
out.Write(L"AttachedMoney", AttachedMoney);
out.WriteEnum(L"Result", Result);
}
void Mail::RetrieveAttached::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Index", Index);
in.Read(L"AttachedMoney", AttachedMoney);
in.ReadEnum(L"Result", Result);
}
const wchar_t* Mail::RollbackFinished::TypeName = L"Mail::RollbackFinished";
const HashType Mail::RollbackFinished::TypeHash =
StringUtil::Hash(Mail::RollbackFinished::TypeName);
void Mail::RollbackFinished::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Mail::RollbackFinished::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
/*********************************************************************** Mail */
/* Fishing
* ***********************************************************************/
const wchar_t* Fishing::Start::TypeName = L"Fishing::Start";
const HashType Fishing::Start::TypeHash =
StringUtil::Hash(Fishing::Start::TypeName);
void Fishing::Start::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"PlayerSerial", PlayerSerial);
}
void Fishing::Start::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"PlayerSerial", PlayerSerial);
}
const wchar_t* Fishing::Do::TypeName = L"Fishing::Do";
const HashType Fishing::Do::TypeHash =
StringUtil::Hash(Fishing::Do::TypeName);
void Fishing::Do::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"PlayerSerial", PlayerSerial);
}
void Fishing::Do::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"PlayerSerial", PlayerSerial);
}
const wchar_t* Fishing::FishingResult::TypeName = L"Fishing::FishingResult";
const HashType Fishing::FishingResult::TypeHash =
StringUtil::Hash(Fishing::FishingResult::TypeName);
void Fishing::FishingResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"PlayerSerial", PlayerSerial);
}
void Fishing::FishingResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"PlayerSerial", PlayerSerial);
}
const wchar_t* Fishing::ChangeBaitCount::TypeName = L"Fishing::ChangeBaitCount";
const HashType Fishing::ChangeBaitCount::TypeHash =
StringUtil::Hash(Fishing::ChangeBaitCount::TypeName);
void Fishing::ChangeBaitCount::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"Count", Count);
}
void Fishing::ChangeBaitCount::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"Count", Count);
}
const wchar_t* Fishing::List::TypeName = L"Fishing::List";
const HashType Fishing::List::TypeHash =
StringUtil::Hash(Fishing::List::TypeName);
void Fishing::List::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"LatestList", LatestList);
out.Write(L"LatestRareList", LatestRareList);
out.Write(L"Epic", Epic);
}
void Fishing::List::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"LatestList", LatestList);
in.Read(L"LatestRareList", LatestRareList);
in.Read(L"Epic", Epic);
}
const wchar_t* Fishing::FishingInfo::TypeName = L"Fishing::FishingInfo";
const HashType Fishing::FishingInfo::TypeHash =
StringUtil::Hash(Fishing::FishingInfo::TypeName);
void Fishing::FishingInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"Info", Info);
}
void Fishing::FishingInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"Info", Info);
}
const wchar_t* Fishing::End::TypeName = L"Fishing::End";
const HashType Fishing::End::TypeHash =
StringUtil::Hash(Fishing::End::TypeName);
void Fishing::End::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"PlayerSerial", PlayerSerial);
}
void Fishing::End::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"PlayerSerial", PlayerSerial);
}
const wchar_t* Fishing::NoticeFishing::TypeName = L"Fishing::NoticeFishing";
const HashType Fishing::NoticeFishing::TypeHash =
StringUtil::Hash(Fishing::NoticeFishing::TypeName);
void Fishing::NoticeFishing::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CharacterName", CharacterName);
out.Write(L"ItemName", ItemName);
}
void Fishing::NoticeFishing::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CharacterName", CharacterName);
in.Read(L"ItemName", ItemName);
}
/*********************************************************************** Fishing
*/
const wchar_t* RaiseEvent::TypeName = L"RaiseEvent";
const HashType RaiseEvent::TypeHash =
StringUtil::Hash(RaiseEvent::TypeName);
void RaiseEvent::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"EventInfo", eventInfo);
out.Write(L"EndTime", endTime);
}
void RaiseEvent::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"EventInfo", eventInfo);
in.Read(L"EndTime", endTime);
}
const wchar_t* Rebirth::TypeName = L"Rebirth";
const HashType Rebirth::TypeHash =
StringUtil::Hash(Rebirth::TypeName);
void Rebirth::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"Level", Level);
out.Write(L"StoredLevel", StoredLevel);
out.Write(L"RebirthCount", RebirthCount);
out.Write(L"StoredSkillPoint", StoredSkillPoint);
out.Write(L"LastRebirthDateTime", LastRebirthDateTime);
out.Write(L"UpdatedLicense", UpdatedLicense);
}
void Rebirth::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"Level", Level);
in.Read(L"StoredLevel", StoredLevel);
in.Read(L"RebirthCount", RebirthCount);
in.Read(L"StoredSkillPoint", StoredSkillPoint);
in.Read(L"LastRebirthDateTime", LastRebirthDateTime);
in.Read(L"UpdatedLicense", UpdatedLicense);
}
/* Gamble
* ***********************************************************************/
const wchar_t* Gamble::SlimeRace::GameStart::TypeName =
L"Gamble::SlimeRace::GameStart";
const HashType Gamble::SlimeRace::GameStart::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::GameStart::TypeName);
void Gamble::SlimeRace::GameStart::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"NotEnoughChipsUsers", NotEnoughChipsUsers);
}
void Gamble::SlimeRace::GameStart::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"NotEnoughChipsUsers", NotEnoughChipsUsers);
}
const wchar_t* Gamble::SlimeRace::GameEnd::TypeName =
L"Gamble::SlimeRace::GameEnd";
const HashType Gamble::SlimeRace::GameEnd::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::GameEnd::TypeName);
void Gamble::SlimeRace::GameEnd::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"WinnerNumber", WinnerNumber);
out.Write(L"Winners", Winners);
out.Write(L"JackPotCharacter", JackPotCharacter);
out.Write(L"EarnedChips", EarnedChips);
out.Write(L"EarnedMoney", EarnedMoney);
out.Write(L"ReceivedMoneyByMail", ReceivedMoneyByMail);
}
void Gamble::SlimeRace::GameEnd::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"WinnerNumber", WinnerNumber);
in.Read(L"Winners", Winners);
in.Read(L"JackPotCharacter", JackPotCharacter);
in.Read(L"EarnedChips", EarnedChips);
in.Read(L"EarnedMoney", EarnedMoney);
in.Read(L"ReceivedMoneyByMail", ReceivedMoneyByMail);
}
const wchar_t* Gamble::SlimeRace::NoMoreBet::TypeName =
L"Gamble::SlimeRace::NoMoreBet";
const HashType Gamble::SlimeRace::NoMoreBet::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::NoMoreBet::TypeName);
void Gamble::SlimeRace::NoMoreBet::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"NotEnoughChipsUsers", NotEnoughChipsUsers);
}
void Gamble::SlimeRace::NoMoreBet::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"NotEnoughChipsUsers", NotEnoughChipsUsers);
}
const wchar_t* Gamble::SlimeRace::ResetGame::TypeName =
L"Gamble::SlimeRace::ResetGame";
const HashType Gamble::SlimeRace::ResetGame::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::ResetGame::TypeName);
void Gamble::SlimeRace::ResetGame::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"NextGameTime", NextGameTime);
}
void Gamble::SlimeRace::ResetGame::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"NextGameTime", NextGameTime);
}
const wchar_t* Gamble::SlimeRace::Bet::TypeName = L"Gamble::SlimeRace::Bet";
const HashType Gamble::SlimeRace::Bet::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::Bet::TypeName);
void Gamble::SlimeRace::Bet::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"CharacterName", CharacterName);
out.WriteEnum(L"Position", Position);
out.Write(L"Chips", Chips);
}
void Gamble::SlimeRace::Bet::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"CharacterName", CharacterName);
in.ReadEnum(L"Position", Position);
in.Read(L"Chips", Chips);
}
const wchar_t* Gamble::SlimeRace::ClearBet::TypeName =
L"Gamble::SlimeRace::ClearBet";
const HashType Gamble::SlimeRace::ClearBet::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::ClearBet::TypeName);
void Gamble::SlimeRace::ClearBet::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"CharacterName", CharacterName);
out.WriteEnum(L"Position", Position);
// out.Write( L"Chips" , Chips );
}
void Gamble::SlimeRace::ClearBet::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"CharacterName", CharacterName);
in.ReadEnum(L"Position", Position);
// in.Read( L"Chips" , Chips );
}
const wchar_t* Gamble::SlimeRace::SentBettingState::TypeName =
L"Gamble::SlimeRace::SentBettingState";
const HashType Gamble::SlimeRace::SentBettingState::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::SentBettingState::TypeName);
void Gamble::SlimeRace::SentBettingState::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"BettingStates", BettingStates);
}
void Gamble::SlimeRace::SentBettingState::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"BettingStates", BettingStates);
}
const wchar_t* Gamble::SlimeRace::SentRecentResults::TypeName =
L"Gamble::SlimeRace::SentRecentResults";
const HashType Gamble::SlimeRace::SentRecentResults::TypeHash =
StringUtil::Hash(Gamble::SlimeRace::SentRecentResults::TypeName);
void Gamble::SlimeRace::SentRecentResults::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"bBettingPossible", bBettingPossible);
out.Write(L"NextGameTime", NextGameTime);
out.Write(L"Results", Results);
}
void Gamble::SlimeRace::SentRecentResults::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"bBettingPossible", bBettingPossible);
in.Read(L"NextGameTime", NextGameTime);
in.Read(L"Results", Results);
}
/*********************************************************************** Gamble
*/
// NoticeRaisePopupStage ////////////////////////////////////////////////////
const wchar_t* NoticeRaisePopupStage::TypeName = L"NoticeRaisePopupStage";
const HashType NoticeRaisePopupStage::TypeHash =
StringUtil::Hash(NoticeRaisePopupStage::TypeName);
void NoticeRaisePopupStage::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CharacterName", CharacterName);
out.Write(L"StageGroupHash", StageGroupHash);
out.Write(L"AccessLevel", AccessLevel);
}
void NoticeRaisePopupStage::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CharacterName", CharacterName);
in.Read(L"StageGroupHash", StageGroupHash);
in.Read(L"AccessLevel", AccessLevel);
}
///////////////////////////////////////////////////// NoticeRaisePopupStage //
// NoticeMythTowerFloor ////////////////////////////////////////////////////
const wchar_t* NoticeMythTowerFloor::TypeName = L"NoticeMythTowerFloor";
const HashType NoticeMythTowerFloor::TypeHash =
StringUtil::Hash(NoticeMythTowerFloor::TypeName);
void NoticeMythTowerFloor::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CharacterName", CharacterName);
out.Write(L"Floor", Floor);
out.Write(L"StageGroupHash", StageGroupHash);
out.Write(L"AccessLevel", AccessLevel);
}
void NoticeMythTowerFloor::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CharacterName", CharacterName);
in.Read(L"Floor", Floor);
in.Read(L"StageGroupHash", StageGroupHash);
in.Read(L"AccessLevel", AccessLevel);
}
///////////////////////////////////////////////////// NoticeRaisePopupStage //
// PvPRewardInfo /////////////////////////////////////////////////////////////
const wchar_t* PvPRewardInfo::TypeName = L"PvPRewardInfo";
const HashType PvPRewardInfo::TypeHash =
StringUtil::Hash(PvPRewardInfo::TypeName);
void PvPRewardInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"WinnerHash", WinnerHash);
out.Write(L"WinnerCount", WinnerCount);
out.Write(L"LoserHash", LoserHash);
out.Write(L"LoserCount", LoserCount);
}
void PvPRewardInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"WinnerHash", WinnerHash);
in.Read(L"WinnerCount", WinnerCount);
in.Read(L"LoserHash", LoserHash);
in.Read(L"LoserCount", LoserCount);
}
///////////////////////////////////////////////////////////// PvPRewardInfo //
// PvPRewardItemGain /////////////////////////////////////////////////////////
const wchar_t* PvPRewardItemGain::TypeName = L"PvPRewardItemGain";
const HashType PvPRewardItemGain::TypeHash =
StringUtil::Hash(PvPRewardItemGain::TypeName);
void PvPRewardItemGain::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"PlayerSerial", PlayerSerial);
out.Write(L"MailSupport", MailSupport);
out.Write(L"Hash", Hash);
out.Write(L"Count", Count);
}
void PvPRewardItemGain::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"PlayerSerial", PlayerSerial);
in.Read(L"MailSupport", MailSupport);
in.Read(L"Hash", Hash);
in.Read(L"Count", Count);
}
///////////////////////////////////////////////////////// PvPRewardItemGain //
// Family
// //////////////////////////////////////////////////////////////////////////////////
// Info
const wchar_t* Family::Info::TypeName = L"Family::Info";
const HashType Family::Info::TypeHash =
StringUtil::Hash(Family::Info::TypeName);
void Family::Info::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"FamilyInfo", FamilyInfo);
out.Write(L"Condition", Condition);
out.Write(L"Members", Members);
}
void Family::Info::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"FamilyInfo", FamilyInfo);
in.Read(L"Condition", Condition);
in.Read(L"Members", Members);
}
// InviteResult
const wchar_t* Family::InviteResult::TypeName = L"Family::InviteResult";
const HashType Family::InviteResult::TypeHash =
StringUtil::Hash(Family::InviteResult::TypeName);
void Family::InviteResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Family::InviteResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
// RequestToInvite
const wchar_t* Family::RequestToInvite::TypeName = L"Family::RequestToInvite";
const HashType Family::RequestToInvite::TypeHash =
StringUtil::Hash(Family::RequestToInvite::TypeName);
void Family::RequestToInvite::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"FromOwner", FromOwner);
}
void Family::RequestToInvite::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"FromOwner", FromOwner);
}
// JoineResult
const wchar_t* Family::JoineResult::TypeName = L"Family::JoineResult";
const HashType Family::JoineResult::TypeHash =
StringUtil::Hash(Family::JoineResult::TypeName);
void Family::JoineResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"InviteOwner", InviteOwner);
}
void Family::JoineResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"InviteOwner", InviteOwner);
}
// JoineResult
const wchar_t* Family::LeavedResult::TypeName = L"Family::LeavedResult";
const HashType Family::LeavedResult::TypeHash =
StringUtil::Hash(Family::LeavedResult::TypeName);
void Family::LeavedResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void Family::LeavedResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
// TakePresentResult
const wchar_t* Family::TakePresentResult::TypeName =
L"Family::TakePresentResult";
const HashType Family::TakePresentResult::TypeHash =
StringUtil::Hash(Family::TakePresentResult::TypeName);
void Family::TakePresentResult::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"Param", Param);
out.Write(L"IsSuccess", IsSuccess);
out.WriteEnum(L"Type", Type);
out.Write(L"Condition", Condition);
out.Write(L"ReceiveMembers", receiveMembers);
}
void Family::TakePresentResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"Param", Param);
in.Read(L"IsSuccess", IsSuccess);
in.ReadEnum(L"Type", Type);
in.Read(L"Condition", Condition);
in.Read(L"ReceiveMembers", receiveMembers);
}
// RefreshFailed
const wchar_t* Family::RefreshFailed::TypeName = L"Family::RefreshFailed";
const HashType Family::RefreshFailed::TypeHash =
StringUtil::Hash(Family::RefreshFailed::TypeName);
void Family::RefreshFailed::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Type", Result);
}
void Family::RefreshFailed::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Type", Result);
}
// KickResult
const wchar_t* Family::KickResult::TypeName = L"Family::KickResult";
const HashType Family::KickResult::TypeHash =
StringUtil::Hash(Family::KickResult::TypeName);
void Family::KickResult::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Type", Result);
out.Write(L"Target", Target);
}
void Family::KickResult::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Type", Result);
in.Read(L"Target", Target);
}
// OpenMarket
// //////////////////////////////////////////////////////////////////////////////////
// RequestProductList
const wchar_t* OpenMarket::RequestProductList::TypeName =
L"OpenMarket::RequestProductList";
const HashType OpenMarket::RequestProductList::TypeHash =
StringUtil::Hash(OpenMarket::RequestProductList::TypeName);
void OpenMarket::RequestProductList::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ProductInfos", ProductInfos);
out.WriteEnum(L"OrderType", OrderType);
out.Write(L"CurrentPage", CurrentPage);
out.Write(L"TotalPage", TotalPage);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::RequestProductList::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ProductInfos", ProductInfos);
in.ReadEnum(L"OrderType", OrderType);
in.Read(L"CurrentPage", CurrentPage);
in.Read(L"TotalPage", TotalPage);
in.ReadEnum(L"Result", Result);
}
// RequestProductInfo
const wchar_t* OpenMarket::RequestProductInfo::TypeName =
L"OpenMarket::RequestProductInfo";
const HashType OpenMarket::RequestProductInfo::TypeHash =
StringUtil::Hash(OpenMarket::RequestProductInfo::TypeName);
void OpenMarket::RequestProductInfo::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"RegistrationNumber", RegistrationNumber);
out.Write(L"AveragePrice", AveragePrice);
out.Write(L"ReliableCount", ReliableCount);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::RequestProductInfo::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"RegistrationNumber", RegistrationNumber);
in.Read(L"AveragePrice", AveragePrice);
in.Read(L"ReliableCount", ReliableCount);
in.ReadEnum(L"Result", Result);
}
// RequestItemInfo
const wchar_t* OpenMarket::RequestItemInfo::TypeName =
L"OpenMarket::RequestItemInfo";
const HashType OpenMarket::RequestItemInfo::TypeHash =
StringUtil::Hash(OpenMarket::RequestItemInfo::TypeName);
void OpenMarket::RequestItemInfo::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"AveragePrice", AveragePrice);
out.Write(L"ReliableCount", ReliableCount);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::RequestItemInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"AveragePrice", AveragePrice);
in.Read(L"ReliableCount", ReliableCount);
in.ReadEnum(L"Result", Result);
}
// BuyProduct
const wchar_t* OpenMarket::BuyProduct::TypeName = L"OpenMarket::BuyProduct";
const HashType OpenMarket::BuyProduct::TypeHash =
StringUtil::Hash(OpenMarket::BuyProduct::TypeName);
void OpenMarket::BuyProduct::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::BuyProduct::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
}
// RegisterItem
const wchar_t* OpenMarket::RegisterItem::TypeName = L"OpenMarket::RegisterItem";
const HashType OpenMarket::RegisterItem::TypeHash =
StringUtil::Hash(OpenMarket::RegisterItem::TypeName);
void OpenMarket::RegisterItem::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"RegistrationNumber", RegistrationNumber);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::RegisterItem::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"RegistrationNumber", RegistrationNumber);
in.ReadEnum(L"Result", Result);
}
// RegistrationCancel
const wchar_t* OpenMarket::RegistrationCancel::TypeName =
L"OpenMarket::RegistrationCancel";
const HashType OpenMarket::RegistrationCancel::TypeHash =
StringUtil::Hash(OpenMarket::RegistrationCancel::TypeName);
void OpenMarket::RegistrationCancel::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"RegistrationNumber", RegistrationNumber);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::RegistrationCancel::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"RegistrationNumber", RegistrationNumber);
in.ReadEnum(L"Result", Result);
}
// MyProductList
const wchar_t* OpenMarket::MyProductList::TypeName =
L"OpenMarket::MyProductList";
const HashType OpenMarket::MyProductList::TypeHash =
StringUtil::Hash(OpenMarket::MyProductList::TypeName);
void OpenMarket::MyProductList::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"ProductInfos", ProductInfos);
out.WriteEnum(L"Result", Result);
}
void OpenMarket::MyProductList::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"ProductInfos", ProductInfos);
in.ReadEnum(L"Result", Result);
}
const wchar_t* ChangeWeather::TypeName = L"ChangeWeather";
const HashType ChangeWeather::TypeHash =
StringUtil::Hash(ChangeWeather::TypeName);
void ChangeWeather::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Type", type);
out.Write(L"FadeInTime", fadeInTime);
}
void ChangeWeather::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Type", type);
in.Read(L"FadeInTime", fadeInTime);
}
const wchar_t* PlayTimeEventInfo::TypeName = L"PlayTimeEventInfo";
const HashType PlayTimeEventInfo::TypeHash =
StringUtil::Hash(PlayTimeEventInfo::TypeName);
void PlayTimeEventInfo::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"CurrentStackedTodayPlayTime", currentStackedTodayPlayTime);
out.Write(L"PlayTimeEventRewards", playTimeEventRewards);
out.Write(L"LevelUpEventRewards", levelUpEventRewards);
}
void PlayTimeEventInfo::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"CurrentStackedTodayPlayTime", currentStackedTodayPlayTime);
in.Read(L"PlayTimeEventRewards", playTimeEventRewards,
PlayTimeEventRewards());
in.Read(L"LevelUpEventRewards", levelUpEventRewards, LevelUpEventRewards());
}
const wchar_t* CashShop::CashAmount::TypeName = L"CashShop::CashAmount";
const HashType CashShop::CashAmount::TypeHash =
StringUtil::Hash(CashShop::CashAmount::TypeName);
void CashShop::CashAmount::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", result);
out.Write(L"CashAmount", cashAmount);
out.Write(L"PointAmount", pointAmount); // 3.1 by Robotex
}
void CashShop::CashAmount::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", result);
in.Read(L"CashAmount", cashAmount);
in.Read(L"PointAmount", pointAmount); // 3.1 by Robotex
}
const wchar_t* CashShop::PurchaseResponse::TypeName =
L"CashShop::PurchaseResponse";
const HashType CashShop::PurchaseResponse::TypeHash =
StringUtil::Hash(CashShop::PurchaseResponse::TypeName);
void CashShop::PurchaseResponse::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", result);
out.Write(L"availableLevelRate", availableLevelRate); // 3.1 by ultimate
}
void CashShop::PurchaseResponse::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", result);
in.Read(L"availableLevelRate", availableLevelRate); // 3.1 by ultimate
}
const wchar_t* CashShop::PresentResponse::TypeName =
L"CashShop::PresentResponse";
const HashType CashShop::PresentResponse::TypeHash =
StringUtil::Hash(CashShop::PresentResponse::TypeName);
void CashShop::PresentResponse::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", result);
out.Write(L"availableLevelRate", availableLevelRate); // 3.1 by ultimate
}
void CashShop::PresentResponse::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", result);
in.Read(L"availableLevelRate", availableLevelRate); // 3.1 by ultimate
}
const wchar_t* CashShop::RegistCouponResponse::TypeName =
L"CashShop::RegistCouponResponse";
const HashType CashShop::RegistCouponResponse::TypeHash =
StringUtil::Hash(CashShop::RegistCouponResponse::TypeName);
void CashShop::RegistCouponResponse::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", result);
}
void CashShop::RegistCouponResponse::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", result);
}
const wchar_t* AchievementServerAssigned::TypeName =
L"AchievementServerAssigned";
const HashType AchievementServerAssigned::TypeHash =
StringUtil::Hash(AchievementServerAssigned::TypeName);
void AchievementServerAssigned::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.WriteEnum(L"Result", Result);
out.Write(L"serverName", serverName);
out.Write(L"serverAddress", serverAddress);
}
void AchievementServerAssigned::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.ReadEnum(L"Result", Result);
in.Read(L"serverName", serverName);
in.Read(L"serverAddress", serverAddress);
}
const wchar_t* AchievementList::TypeName =
L"AchievementList";
const HashType AchievementList::TypeHash =
StringUtil::Hash(AchievementList::TypeName);
void AchievementList::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"characterName", characterName);
out.Write(L"mainCategory", mainCategory);
out.Write(L"subCategory", subCategory);
//out.Write(L"completedList", completedList);
out.Write(L"totalScore", totalScore);
out.WriteEnum(L"Result", Result);
}
void AchievementList::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"characterName", characterName);
in.Read(L"mainCategory", mainCategory);
in.Read(L"subCategory", subCategory);
//in.Read(L"completedList", completedList);
in.Read(L"totalScore", totalScore);
in.ReadEnum(L"Result", Result);
}
// this working? i need debug 3.1 client
// this is called on change this status, probably in User.cpp :o
const wchar_t* ChangeStatusLimit::TypeName = L"ChangeStatusLimit";
const HashType ChangeStatusLimit::TypeHash = StringUtil::Hash(ChangeStatusLimit::TypeName);
void ChangeStatusLimit::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"statusLimits", statusLimit);
/*unsigned char teste[] = {0x8E, 0xCE, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x39, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x39, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x39, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x39, 0x04, 0x00, 0x00};
out.WriteArray(L"statusLimits",teste, sizeof(teste) );*/
}
void ChangeStatusLimit::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"statusLimits", statusLimit);
}
// this is called on change this status, probably in User.cpp :o
const wchar_t* ChangeStatusRate::TypeName = L"ChangeStatusRate";
const HashType ChangeStatusRate::TypeHash = StringUtil::Hash(ChangeStatusRate::TypeName);
void ChangeStatusRate::Serialize(Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"statusRates", statusRates);
}
void ChangeStatusRate::Deserialize(Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"statusRates", statusRates);
}
/* const wchar_t* ChangeStatusLimit::StatusLimits::TypeName =
L"statusLimits";
const HashType ChangeStatusLimit::StatusLimits::TypeHash =
StringUtil::Hash(ChangeStatusLimit::StatusLimits::TypeName);
void ChangeStatusLimit::StatusLimits::Serialize(
Serializer::IStreamWriter& out) const {
out.Begin(TypeName);
out.Write(L"status", status);
out.Write(L"limit", limit);
printf("StatusLimit Serializer\n");
}
void ChangeStatusLimit::StatusLimits::Deserialize(
Serializer::IStreamReader& in) {
in.Begin(TypeName);
in.Read(L"status", status);
in.Read(L"limit", limit);
} */
} // namespace FromServer
}
}
}
} | [
"mteleshenrique@gmail.com"
] | mteleshenrique@gmail.com |
494c135329b358c6f63504d0b972bd2d05e6e325 | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/wget/old_hunk_1993.cpp | 794843166c8b0c74113cbcde54b950b21c8d8ae4 | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | ISO-8859-3 | C++ | false | false | 413 | cpp | # Es la función bind(2), que asigna una dirección a un socket.
# Me parece que decir lo de la función es mejor. (nl)
#
#: src/ftp.c:712
#, c-format
msgid "Bind error (%s).\n"
msgstr "Error en la llamada `bind' (%s).\n"
# Ya no está "prohibido" usar esta palabra. sv
#: src/ftp.c:718
msgid "Invalid PORT.\n"
msgstr "PUERTO inválido.\n"
#: src/ftp.c:764
msgid ""
"\n"
"REST failed, starting from scratch.\n"
| [
"993273596@qq.com"
] | 993273596@qq.com |
e1028bb8b650d7e0c4db57385dc8be6217e143af | 08e1accf8db12b0e88f698138c9d51e2b25e25e9 | /DXEngine/Include/Component/Text.h | 64a93335fbe3f5443e8fa57fda19d5c3c6a03d63 | [] | no_license | yoari89/Direct3D | a6b4579143805a12d1bb416e4bfda896ea894aad | 3f12d13297149d411a77b607dfa9905436ec8c77 | refs/heads/master | 2020-04-15T10:10:15.157318 | 2019-01-09T09:03:48 | 2019-01-09T09:03:48 | 164,583,316 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 2,641 | h | #pragma once
#include "Component/Component.h"
ENGINE_BEGIN
enum eTextRenderType
{
TYPE_UI,
TYPE_2D,
TYPE_MAX,
};
enum eTextAlignH
{
ALIGNH_LEFT,
ALIGNH_CENTER,
ALIGNH_RIGHT,
ALIGNH_MAX,
};
enum eTextAlignV
{
ALIGNV_TOP,
ALIGNV_CENTER,
ALIGNV_BOTTOM,
ALIGNV_MAX,
};
class ENGINE_DLL CText : public CComponent
{
private:
friend class CGameObject;
public:
CText();
CText(const CText& _text);
virtual ~CText();
// 컴포넌트 클래스 가상함수 재정의
public:
bool Init() override;
int Input(float _fTime) override;
int Update(float _fTime) override;
int LateUpdate(float _fTime) override;
void Collision(float _fTime) override;
void Render(float _fTime) override;
void AfterClone() override;
CText* Clone() override;
// 텍스트 레이아웃
// > 텍스트 레이아웃은 고정 텍스트이므로 사용하지 않는다.
// > ID2D1RenderTarget을 통하여 텍스트를 그리는 방식을 사용한다.
private:
eTextAlignH m_eAlignH;
eTextAlignV m_eAlignV;
eTextRenderType m_eTextType;
D2D1_RECT_F m_tRenderArea;
ID2D1RenderTarget* m_p2DTarget;
IDWriteTextFormat* m_pTextFormat;
// IDWriteTextLayout* m_pTextLayout;
/*
private:
void CreateLayout();
*/
public:
void SetTextType(eTextRenderType _eType);
void SetAlignH(eTextAlignH _eAlign);
void SetAlignV(eTextAlignV _eAlign);
void SetRenderArea(float _left, float _top, float _right, float _bottom);
// 폰트
private:
bool m_isAlpha;
float m_fontSize;
float m_fontOpacity;
const wchar_t* m_pFont;
const wchar_t* m_pText;
Vector4 m_vColor;
ID2D1SolidColorBrush* m_pBrush;
public:
void AlphaBlend(bool _isAlpha);
void SetFont(wchar_t* _pFont);
void SetText(const wchar_t* _pText);
void SetFontSize(float _fontSize);
void SetColor(const Vector4& _vColor);
void SetColor(float _r, float _g, float _b, float _a);
void SetColor(unsigned char _r, unsigned char _g,
unsigned char _b, unsigned char _a);
void SetFontOpacity(float _fontOpacity);
// 그림자
private:
bool m_isShadow;
bool m_isAlphaShadow;
float m_shadowOpacity;
Vector3 m_vShadowOffset;
Vector4 m_vShadowColor;
D2D1_RECT_F m_tShadowRenderArea;
ID2D1SolidColorBrush* m_pShadowBrush;
public:
void Shadow(bool _isShadow);
void ShadowAlphaBlend(bool _isAlpha);
void SetShadowOpacity(float _shadowOpacity);
void SetShadowOffset(const Vector3& _vOffset);
void SetShadowColor(const Vector4& _vColor);
void SetShadowColor(float _r, float _g, float _b, float _a);
void SetShadowColor(unsigned char _r, unsigned char _g,
unsigned char _b, unsigned char _a);
};
ENGINE_END | [
"yoari89@naver.com"
] | yoari89@naver.com |
29de8a0e6041373ee87fde75d182717c53bfdfb8 | 2fbf5b6d174c1c46eedd1b23f31af11a20ee49d6 | /Include/10.0.14393.0/winrt/Windows.ApplicationModel.socialinfo.h | f7aa0f0bd277a0da2ed205411cbacb2daafd6aef | [] | no_license | ojdkbuild/tools_toolchain_sdk10_1607 | f33e01ee825bed4cf09db88844658de9fb84bc17 | a3b2cdc2d3e74f81484514056b17ccc031df6739 | refs/heads/master | 2021-08-30T07:23:14.674769 | 2017-12-16T18:04:05 | 2017-12-16T18:04:05 | 114,480,401 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 181,884 | h |
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0618 */
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __windows2Eapplicationmodel2Esocialinfo_h__
#define __windows2Eapplicationmodel2Esocialinfo_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#endif /* ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#endif /* ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__ */
#ifndef ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#endif /* ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#endif /* ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__ */
#ifndef ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
typedef interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#endif /* ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__ */
#ifndef ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
typedef interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#endif /* ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__ */
#ifndef ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
typedef interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#endif /* ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__ */
#ifndef ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
typedef interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#endif /* ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_FWD_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialFeedChildItem;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_FWD_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialFeedContent;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_FWD_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialFeedItem;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_FWD_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialFeedSharedItem;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_FWD_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialItemThumbnail;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_FWD_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialUserInfo;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_FWD_DEFINED__ */
/* header files for imported files */
#include "inspectable.h"
#include "AsyncInfo.h"
#include "EventToken.h"
#include "Windows.Foundation.h"
#include "Windows.Graphics.Imaging.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0000 */
/* [local] */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#include <windows.foundation.collections.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
class SocialFeedItem;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialFeedItem;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0000 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0000_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3186 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3186 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3186_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3186_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0001 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#define DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("e7c8cd1f-3907-5da8-9d72-90426dc37072"))
IIterator<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*, ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.ApplicationModel.SocialInfo.SocialFeedItem>"; }
};
typedef IIterator<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t;
#define ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0001 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0001_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3187 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3187 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3187_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3187_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0002 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#define DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("ad33d864-9569-5e2d-bd72-182a8ff50cf6"))
IIterable<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*, ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.ApplicationModel.SocialInfo.SocialFeedItem>"; }
};
typedef IIterable<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t;
#define ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE */
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
class SocialItemThumbnail;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
interface ISocialItemThumbnail;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0002 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0002_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3188 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3188 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3188_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3188_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0003 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#define DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("fabcf39f-fd48-5550-8f47-a0f1573e1f53"))
IIterator<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*, ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.ApplicationModel.SocialInfo.SocialItemThumbnail>"; }
};
typedef IIterator<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t;
#define ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0003 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0003_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0003_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3189 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3189 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3189_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3189_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0004 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#define DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("5d102c6d-92c3-59f3-b1dc-5986c56445a5"))
IIterable<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*, ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.ApplicationModel.SocialInfo.SocialItemThumbnail>"; }
};
typedef IIterable<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t;
#define ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0004 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0004_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3190 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3190 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3190_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3190_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0005 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#define DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("e6be2bb8-fc75-585c-836c-34f3ff87680f"))
IVectorView<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> : IVectorView_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*, ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IVectorView`1<Windows.ApplicationModel.SocialInfo.SocialFeedItem>"; }
};
typedef IVectorView<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t;
#define ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem ABI::Windows::Foundation::Collections::__FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0005 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0005_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0005_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3191 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3191 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3191_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3191_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0006 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#define DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("9a3e6d46-e880-5deb-9006-92fe5c43ace1"))
IVectorView<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> : IVectorView_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*, ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IVectorView`1<Windows.ApplicationModel.SocialInfo.SocialItemThumbnail>"; }
};
typedef IVectorView<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t;
#define ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail ABI::Windows::Foundation::Collections::__FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0006 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0006_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0006_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3192 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3192 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3192_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3192_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0007 */
/* [local] */
#ifndef DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#define DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("36cd5297-36c3-56a7-9656-ec9d5bde7aba"))
IVector<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> : IVector_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*, ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IVector`1<Windows.ApplicationModel.SocialInfo.SocialFeedItem>"; }
};
typedef IVector<ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItem*> __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t;
#define ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_FWD_DEFINED__
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem ABI::Windows::Foundation::Collections::__FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_USE */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0007 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0007_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3193 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3193 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3193_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3193_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0008 */
/* [local] */
#ifndef DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#define DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("c210bbd7-2f56-5076-bb0e-b7497726cf95"))
IVector<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> : IVector_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*, ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IVector`1<Windows.ApplicationModel.SocialInfo.SocialItemThumbnail>"; }
};
typedef IVector<ABI::Windows::ApplicationModel::SocialInfo::SocialItemThumbnail*> __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t;
#define ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_FWD_DEFINED__
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail ABI::Windows::Foundation::Collections::__FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_USE */
#if defined(__cplusplus)
}
#endif // defined(__cplusplus)
#include <Windows.Foundation.h>
#if !defined(__windows2Egraphics2Eimaging_h__)
#include <Windows.Graphics.Imaging.h>
#endif // !defined(__windows2Egraphics2Eimaging_h__)
#if !defined(__windows2Estorage2Estreams_h__)
#include <Windows.Storage.Streams.h>
#endif // !defined(__windows2Estorage2Estreams_h__)
#if defined(__cplusplus)
extern "C" {
#endif // defined(__cplusplus)
#if !defined(__cplusplus)
typedef struct __x_ABI_CWindows_CFoundation_CDateTime __x_ABI_CWindows_CFoundation_CDateTime;
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Foundation {
class Uri;
} /*Foundation*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
typedef struct __x_ABI_CWindows_CGraphics_CImaging_CBitmapSize __x_ABI_CWindows_CGraphics_CImaging_CBitmapSize;
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedItemStyle __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedItemStyle;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedKind __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedKind;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedUpdateMode __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedUpdateMode;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialItemBadgeStyle __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialItemBadgeStyle;
#endif /* end if !defined(__cplusplus) */
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
class SocialFeedChildItem;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
class SocialFeedContent;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
class SocialFeedSharedItem;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
class SocialUserInfo;
} /*SocialInfo*/
} /*ApplicationModel*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0008 */
/* [local] */
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Foundation {
typedef struct DateTime DateTime;
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Graphics {
namespace Imaging {
typedef struct BitmapSize BitmapSize;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
typedef enum SocialFeedItemStyle SocialFeedItemStyle;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
typedef enum SocialFeedKind SocialFeedKind;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
typedef enum SocialFeedUpdateMode SocialFeedUpdateMode;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
typedef enum SocialItemBadgeStyle SocialItemBadgeStyle;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0008_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0008_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3194 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3194 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3194_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3194_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0009 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#define DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0009 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0009_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0009_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("e7c8cd1f-3907-5da8-9d72-90426dc37072")
__FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl;
interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
{
CONST_VTBL struct __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0010 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0010 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0010_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0010_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3195 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3195 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3195_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3195_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0011 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#define DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0011 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0011_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0011_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("ad33d864-9569-5e2d-bd72-182a8ff50cf6")
__FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem **first);
END_INTERFACE
} __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl;
interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
{
CONST_VTBL struct __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0012 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0012 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0012_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0012_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3196 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3196 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3196_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3196_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0013 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#define DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0013 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0013_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0013_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("fabcf39f-fd48-5550-8f47-a0f1573e1f53")
__FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl;
interface __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
{
CONST_VTBL struct __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0014 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0014 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0014_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0014_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3197 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3197 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3197_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3197_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0015 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#define DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0015 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0015_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0015_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5d102c6d-92c3-59f3-b1dc-5986c56445a5")
__FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **first);
END_INTERFACE
} __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl;
interface __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
{
CONST_VTBL struct __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0016 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0016 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0016_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0016_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3198 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3198 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3198_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3198_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0017 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#define DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0017 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0017_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0017_v0_0_s_ifspec;
#ifndef ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
#define ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
/* interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
/* interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("e6be2bb8-fc75-585c-836c-34f3ff87680f")
__FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **item) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
/* [retval][out] */ __RPC__out unsigned int *size) = 0;
virtual HRESULT STDMETHODCALLTYPE IndexOf(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *GetAt )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **item);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__out unsigned int *size);
HRESULT ( STDMETHODCALLTYPE *IndexOf )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl;
interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
{
CONST_VTBL struct __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetAt(This,index,item) \
( (This)->lpVtbl -> GetAt(This,index,item) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_get_Size(This,size) \
( (This)->lpVtbl -> get_Size(This,size) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_IndexOf(This,item,index,found) \
( (This)->lpVtbl -> IndexOf(This,item,index,found) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetMany(This,startIndex,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,startIndex,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0018 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0018 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0018_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0018_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3199 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3199 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3199_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3199_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0019 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#define DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0019 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0019_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0019_v0_0_s_ifspec;
#ifndef ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
#define ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
/* interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
/* interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9a3e6d46-e880-5deb-9006-92fe5c43ace1")
__FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **item) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
/* [retval][out] */ __RPC__out unsigned int *size) = 0;
virtual HRESULT STDMETHODCALLTYPE IndexOf(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *GetAt )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **item);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__out unsigned int *size);
HRESULT ( STDMETHODCALLTYPE *IndexOf )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl;
interface __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
{
CONST_VTBL struct __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetAt(This,index,item) \
( (This)->lpVtbl -> GetAt(This,index,item) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_get_Size(This,size) \
( (This)->lpVtbl -> get_Size(This,size) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_IndexOf(This,item,index,found) \
( (This)->lpVtbl -> IndexOf(This,item,index,found) )
#define __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetMany(This,startIndex,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,startIndex,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0020 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0020 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0020_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0020_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3200 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3200 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3200_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3200_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0021 */
/* [local] */
#ifndef DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#define DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0021 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0021_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0021_v0_0_s_ifspec;
#ifndef ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
#define ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__
/* interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
/* interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("36cd5297-36c3-56a7-9656-ec9d5bde7aba")
__FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **item) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
/* [retval][out] */ __RPC__out unsigned int *size) = 0;
virtual HRESULT STDMETHODCALLTYPE GetView(
/* [retval][out] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem **view) = 0;
virtual HRESULT STDMETHODCALLTYPE IndexOf(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found) = 0;
virtual HRESULT STDMETHODCALLTYPE SetAt(
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem *item) = 0;
virtual HRESULT STDMETHODCALLTYPE InsertAt(
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem *item) = 0;
virtual HRESULT STDMETHODCALLTYPE RemoveAt(
/* [in] */ unsigned int index) = 0;
virtual HRESULT STDMETHODCALLTYPE Append(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem *item) = 0;
virtual HRESULT STDMETHODCALLTYPE RemoveAtEnd( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
virtual HRESULT STDMETHODCALLTYPE ReplaceAll(
/* [in] */ unsigned int count,
/* [size_is][in] */ __RPC__in_ecount_full(count) ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem **value) = 0;
};
#else /* C style interface */
typedef struct __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *GetAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **item);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__out unsigned int *size);
HRESULT ( STDMETHODCALLTYPE *GetView )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [retval][out] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem **view);
HRESULT ( STDMETHODCALLTYPE *IndexOf )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found);
HRESULT ( STDMETHODCALLTYPE *SetAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem *item);
HRESULT ( STDMETHODCALLTYPE *InsertAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem *item);
HRESULT ( STDMETHODCALLTYPE *RemoveAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int index);
HRESULT ( STDMETHODCALLTYPE *Append )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem *item);
HRESULT ( STDMETHODCALLTYPE *RemoveAtEnd )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *Clear )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
HRESULT ( STDMETHODCALLTYPE *ReplaceAll )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem * This,
/* [in] */ unsigned int count,
/* [size_is][in] */ __RPC__in_ecount_full(count) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem **value);
END_INTERFACE
} __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl;
interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem
{
CONST_VTBL struct __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetAt(This,index,item) \
( (This)->lpVtbl -> GetAt(This,index,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_get_Size(This,size) \
( (This)->lpVtbl -> get_Size(This,size) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetView(This,view) \
( (This)->lpVtbl -> GetView(This,view) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_IndexOf(This,item,index,found) \
( (This)->lpVtbl -> IndexOf(This,item,index,found) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_SetAt(This,index,item) \
( (This)->lpVtbl -> SetAt(This,index,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_InsertAt(This,index,item) \
( (This)->lpVtbl -> InsertAt(This,index,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_RemoveAt(This,index) \
( (This)->lpVtbl -> RemoveAt(This,index) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_Append(This,item) \
( (This)->lpVtbl -> Append(This,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_RemoveAtEnd(This) \
( (This)->lpVtbl -> RemoveAtEnd(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_Clear(This) \
( (This)->lpVtbl -> Clear(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_GetMany(This,startIndex,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,startIndex,capacity,items,actual) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_ReplaceAll(This,count,value) \
( (This)->lpVtbl -> ReplaceAll(This,count,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0022 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialFeedItem */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0022 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0022_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0022_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3201 */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3201 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3201_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo2Eidl_0000_3201_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0023 */
/* [local] */
#ifndef DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#define DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0023 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0023_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0023_v0_0_s_ifspec;
#ifndef ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
#define ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__
/* interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
/* interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("c210bbd7-2f56-5076-bb0e-b7497726cf95")
__FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **item) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
/* [retval][out] */ __RPC__out unsigned int *size) = 0;
virtual HRESULT STDMETHODCALLTYPE GetView(
/* [retval][out] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **view) = 0;
virtual HRESULT STDMETHODCALLTYPE IndexOf(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found) = 0;
virtual HRESULT STDMETHODCALLTYPE SetAt(
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail *item) = 0;
virtual HRESULT STDMETHODCALLTYPE InsertAt(
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail *item) = 0;
virtual HRESULT STDMETHODCALLTYPE RemoveAt(
/* [in] */ unsigned int index) = 0;
virtual HRESULT STDMETHODCALLTYPE Append(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail *item) = 0;
virtual HRESULT STDMETHODCALLTYPE RemoveAtEnd( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
virtual HRESULT STDMETHODCALLTYPE ReplaceAll(
/* [in] */ unsigned int count,
/* [size_is][in] */ __RPC__in_ecount_full(count) ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **value) = 0;
};
#else /* C style interface */
typedef struct __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *GetAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **item);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__out unsigned int *size);
HRESULT ( STDMETHODCALLTYPE *GetView )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [retval][out] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **view);
HRESULT ( STDMETHODCALLTYPE *IndexOf )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found);
HRESULT ( STDMETHODCALLTYPE *SetAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail *item);
HRESULT ( STDMETHODCALLTYPE *InsertAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int index,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail *item);
HRESULT ( STDMETHODCALLTYPE *RemoveAt )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int index);
HRESULT ( STDMETHODCALLTYPE *Append )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail *item);
HRESULT ( STDMETHODCALLTYPE *RemoveAtEnd )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *Clear )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
HRESULT ( STDMETHODCALLTYPE *ReplaceAll )(
__RPC__in __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail * This,
/* [in] */ unsigned int count,
/* [size_is][in] */ __RPC__in_ecount_full(count) __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **value);
END_INTERFACE
} __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl;
interface __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail
{
CONST_VTBL struct __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnailVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetAt(This,index,item) \
( (This)->lpVtbl -> GetAt(This,index,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_get_Size(This,size) \
( (This)->lpVtbl -> get_Size(This,size) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetView(This,view) \
( (This)->lpVtbl -> GetView(This,view) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_IndexOf(This,item,index,found) \
( (This)->lpVtbl -> IndexOf(This,item,index,found) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_SetAt(This,index,item) \
( (This)->lpVtbl -> SetAt(This,index,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_InsertAt(This,index,item) \
( (This)->lpVtbl -> InsertAt(This,index,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_RemoveAt(This,index) \
( (This)->lpVtbl -> RemoveAt(This,index) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_Append(This,item) \
( (This)->lpVtbl -> Append(This,item) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_RemoveAtEnd(This) \
( (This)->lpVtbl -> RemoveAtEnd(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_Clear(This) \
( (This)->lpVtbl -> Clear(This) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_GetMany(This,startIndex,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,startIndex,capacity,items,actual) )
#define __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_ReplaceAll(This,count,value) \
( (This)->lpVtbl -> ReplaceAll(This,count,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0024 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail */
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedItemStyle
{
SocialFeedItemStyle_Default = 0,
SocialFeedItemStyle_Photo = 1
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedKind
{
SocialFeedKind_HomeFeed = 0,
SocialFeedKind_ContactFeed = 1,
SocialFeedKind_Dashboard = 2
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedUpdateMode
{
SocialFeedUpdateMode_Append = 0,
SocialFeedUpdateMode_Replace = 1
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialItemBadgeStyle
{
SocialItemBadgeStyle_Hidden = 0,
SocialItemBadgeStyle_Visible = 1,
SocialItemBadgeStyle_VisibleWithCount = 2
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_ApplicationModel_SocialInfo_ISocialFeedChildItem[] = L"Windows.ApplicationModel.SocialInfo.ISocialFeedChildItem";
#endif /* !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0024 */
/* [local] */
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
/* [v1_enum] */
enum SocialFeedItemStyle
{
SocialFeedItemStyle_Default = 0,
SocialFeedItemStyle_Photo = 1
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
/* [v1_enum] */
enum SocialFeedKind
{
SocialFeedKind_HomeFeed = 0,
SocialFeedKind_ContactFeed = 1,
SocialFeedKind_Dashboard = 2
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
/* [v1_enum] */
enum SocialFeedUpdateMode
{
SocialFeedUpdateMode_Append = 0,
SocialFeedUpdateMode_Replace = 1
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
/* [v1_enum] */
enum SocialItemBadgeStyle
{
SocialItemBadgeStyle_Hidden = 0,
SocialItemBadgeStyle_Visible = 1,
SocialItemBadgeStyle_VisibleWithCount = 2
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0024_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0024_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem */
/* [uuid][object] */
/* interface ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedChildItem */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
MIDL_INTERFACE("0B6A985A-D59D-40BE-980C-488A2AB30A83")
ISocialFeedChildItem : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Author(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialUserInfo **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PrimaryContent(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedContent **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SecondaryContent(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedContent **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Timestamp(
/* [out][retval] */ __RPC__out ABI::Windows::Foundation::DateTime *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Timestamp(
/* [in] */ ABI::Windows::Foundation::DateTime value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TargetUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Thumbnails(
/* [out][retval] */ __RPC__deref_out_opt __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SharedItem(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedSharedItem **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SharedItem(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedSharedItem *value) = 0;
};
extern const __declspec(selectany) IID & IID_ISocialFeedChildItem = __uuidof(ISocialFeedChildItem);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Author )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PrimaryContent )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SecondaryContent )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Timestamp )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CFoundation_CDateTime *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Timestamp )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [in] */ __x_ABI_CWindows_CFoundation_CDateTime value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Thumbnails )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__deref_out_opt __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SharedItem )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SharedItem )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem *value);
END_INTERFACE
} __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItemVtbl;
interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem
{
CONST_VTBL struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_Author(This,value) \
( (This)->lpVtbl -> get_Author(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_PrimaryContent(This,value) \
( (This)->lpVtbl -> get_PrimaryContent(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_SecondaryContent(This,value) \
( (This)->lpVtbl -> get_SecondaryContent(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_Timestamp(This,value) \
( (This)->lpVtbl -> get_Timestamp(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_put_Timestamp(This,value) \
( (This)->lpVtbl -> put_Timestamp(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_TargetUri(This,value) \
( (This)->lpVtbl -> get_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_put_TargetUri(This,value) \
( (This)->lpVtbl -> put_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_Thumbnails(This,value) \
( (This)->lpVtbl -> get_Thumbnails(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_get_SharedItem(This,value) \
( (This)->lpVtbl -> get_SharedItem(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_put_SharedItem(This,value) \
( (This)->lpVtbl -> put_SharedItem(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0025 */
/* [local] */
#if !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_ApplicationModel_SocialInfo_ISocialFeedContent[] = L"Windows.ApplicationModel.SocialInfo.ISocialFeedContent";
#endif /* !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0025 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0025_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0025_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent */
/* [uuid][object] */
/* interface ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedContent */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
MIDL_INTERFACE("A234E429-3E39-494D-A37C-F462A2494514")
ISocialFeedContent : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Title(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Title(
/* [in] */ __RPC__in HSTRING value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Message(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Message(
/* [in] */ __RPC__in HSTRING value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TargetUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
};
extern const __declspec(selectany) IID & IID_ISocialFeedContent = __uuidof(ISocialFeedContent);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContentVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Title )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Title )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [in] */ __RPC__in HSTRING value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Message )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Message )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [in] */ __RPC__in HSTRING value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
END_INTERFACE
} __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContentVtbl;
interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent
{
CONST_VTBL struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContentVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_get_Title(This,value) \
( (This)->lpVtbl -> get_Title(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_put_Title(This,value) \
( (This)->lpVtbl -> put_Title(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_get_Message(This,value) \
( (This)->lpVtbl -> get_Message(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_put_Message(This,value) \
( (This)->lpVtbl -> put_Message(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_get_TargetUri(This,value) \
( (This)->lpVtbl -> get_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_put_TargetUri(This,value) \
( (This)->lpVtbl -> put_TargetUri(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0026 */
/* [local] */
#if !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_ApplicationModel_SocialInfo_ISocialFeedItem[] = L"Windows.ApplicationModel.SocialInfo.ISocialFeedItem";
#endif /* !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0026 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0026_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0026_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem */
/* [uuid][object] */
/* interface ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedItem */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
MIDL_INTERFACE("4F1392AB-1F72-4D33-B695-DE3E1DB60317")
ISocialFeedItem : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Author(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialUserInfo **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PrimaryContent(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedContent **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SecondaryContent(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedContent **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Timestamp(
/* [out][retval] */ __RPC__out ABI::Windows::Foundation::DateTime *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Timestamp(
/* [in] */ ABI::Windows::Foundation::DateTime value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TargetUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Thumbnails(
/* [out][retval] */ __RPC__deref_out_opt __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SharedItem(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedSharedItem **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SharedItem(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedSharedItem *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BadgeStyle(
/* [out][retval] */ __RPC__out ABI::Windows::ApplicationModel::SocialInfo::SocialItemBadgeStyle *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BadgeStyle(
/* [in] */ ABI::Windows::ApplicationModel::SocialInfo::SocialItemBadgeStyle value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BadgeCountValue(
/* [out][retval] */ __RPC__out INT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BadgeCountValue(
/* [in] */ INT32 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RemoteId(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RemoteId(
/* [in] */ __RPC__in HSTRING value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ChildItem(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedChildItem **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ChildItem(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedChildItem *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Style(
/* [out][retval] */ __RPC__out ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItemStyle *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Style(
/* [in] */ ABI::Windows::ApplicationModel::SocialInfo::SocialFeedItemStyle value) = 0;
};
extern const __declspec(selectany) IID & IID_ISocialFeedItem = __uuidof(ISocialFeedItem);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Author )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PrimaryContent )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SecondaryContent )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Timestamp )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CFoundation_CDateTime *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Timestamp )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __x_ABI_CWindows_CFoundation_CDateTime value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Thumbnails )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __FIVector_1_Windows__CApplicationModel__CSocialInfo__CSocialItemThumbnail **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SharedItem )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SharedItem )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BadgeStyle )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialItemBadgeStyle *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BadgeStyle )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialItemBadgeStyle value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BadgeCountValue )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__out INT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BadgeCountValue )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ INT32 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RemoteId )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RemoteId )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __RPC__in HSTRING value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ChildItem )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ChildItem )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedChildItem *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Style )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedItemStyle *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Style )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem * This,
/* [in] */ __x_ABI_CWindows_CApplicationModel_CSocialInfo_CSocialFeedItemStyle value);
END_INTERFACE
} __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItemVtbl;
interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem
{
CONST_VTBL struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_Author(This,value) \
( (This)->lpVtbl -> get_Author(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_PrimaryContent(This,value) \
( (This)->lpVtbl -> get_PrimaryContent(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_SecondaryContent(This,value) \
( (This)->lpVtbl -> get_SecondaryContent(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_Timestamp(This,value) \
( (This)->lpVtbl -> get_Timestamp(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_Timestamp(This,value) \
( (This)->lpVtbl -> put_Timestamp(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_TargetUri(This,value) \
( (This)->lpVtbl -> get_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_TargetUri(This,value) \
( (This)->lpVtbl -> put_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_Thumbnails(This,value) \
( (This)->lpVtbl -> get_Thumbnails(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_SharedItem(This,value) \
( (This)->lpVtbl -> get_SharedItem(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_SharedItem(This,value) \
( (This)->lpVtbl -> put_SharedItem(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_BadgeStyle(This,value) \
( (This)->lpVtbl -> get_BadgeStyle(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_BadgeStyle(This,value) \
( (This)->lpVtbl -> put_BadgeStyle(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_BadgeCountValue(This,value) \
( (This)->lpVtbl -> get_BadgeCountValue(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_BadgeCountValue(This,value) \
( (This)->lpVtbl -> put_BadgeCountValue(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_RemoteId(This,value) \
( (This)->lpVtbl -> get_RemoteId(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_RemoteId(This,value) \
( (This)->lpVtbl -> put_RemoteId(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_ChildItem(This,value) \
( (This)->lpVtbl -> get_ChildItem(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_ChildItem(This,value) \
( (This)->lpVtbl -> put_ChildItem(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_get_Style(This,value) \
( (This)->lpVtbl -> get_Style(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_put_Style(This,value) \
( (This)->lpVtbl -> put_Style(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0027 */
/* [local] */
#if !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_ApplicationModel_SocialInfo_ISocialFeedSharedItem[] = L"Windows.ApplicationModel.SocialInfo.ISocialFeedSharedItem";
#endif /* !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0027 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0027_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0027_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem */
/* [uuid][object] */
/* interface ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedSharedItem */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
MIDL_INTERFACE("7BFB9E40-A6AA-45A7-9FF6-54C42105DD1F")
ISocialFeedSharedItem : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OriginalSource(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_OriginalSource(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Content(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialFeedContent **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Timestamp(
/* [out][retval] */ __RPC__out ABI::Windows::Foundation::DateTime *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Timestamp(
/* [in] */ ABI::Windows::Foundation::DateTime value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TargetUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Thumbnail(
/* [in] */ __RPC__in_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Thumbnail(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail **value) = 0;
};
extern const __declspec(selectany) IID & IID_ISocialFeedSharedItem = __uuidof(ISocialFeedSharedItem);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItemVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OriginalSource )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_OriginalSource )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Content )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedContent **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Timestamp )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CFoundation_CDateTime *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Timestamp )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [in] */ __x_ABI_CWindows_CFoundation_CDateTime value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Thumbnail )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Thumbnail )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail **value);
END_INTERFACE
} __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItemVtbl;
interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem
{
CONST_VTBL struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItemVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_get_OriginalSource(This,value) \
( (This)->lpVtbl -> get_OriginalSource(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_put_OriginalSource(This,value) \
( (This)->lpVtbl -> put_OriginalSource(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_get_Content(This,value) \
( (This)->lpVtbl -> get_Content(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_get_Timestamp(This,value) \
( (This)->lpVtbl -> get_Timestamp(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_put_Timestamp(This,value) \
( (This)->lpVtbl -> put_Timestamp(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_get_TargetUri(This,value) \
( (This)->lpVtbl -> get_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_put_TargetUri(This,value) \
( (This)->lpVtbl -> put_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_put_Thumbnail(This,value) \
( (This)->lpVtbl -> put_Thumbnail(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_get_Thumbnail(This,value) \
( (This)->lpVtbl -> get_Thumbnail(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialFeedSharedItem_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0028 */
/* [local] */
#if !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_ApplicationModel_SocialInfo_ISocialItemThumbnail[] = L"Windows.ApplicationModel.SocialInfo.ISocialItemThumbnail";
#endif /* !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0028 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0028_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0028_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail */
/* [uuid][object] */
/* interface ABI::Windows::ApplicationModel::SocialInfo::ISocialItemThumbnail */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
MIDL_INTERFACE("5CBF831A-3F08-497F-917F-57E09D84B141")
ISocialItemThumbnail : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TargetUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ImageUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ImageUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BitmapSize(
/* [out][retval] */ __RPC__out ABI::Windows::Graphics::Imaging::BitmapSize *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BitmapSize(
/* [in] */ ABI::Windows::Graphics::Imaging::BitmapSize value) = 0;
virtual HRESULT STDMETHODCALLTYPE SetImageAsync(
/* [in] */ __RPC__in_opt ABI::Windows::Storage::Streams::IInputStream *image,
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IAsyncAction **operation) = 0;
};
extern const __declspec(selectany) IID & IID_ISocialItemThumbnail = __uuidof(ISocialItemThumbnail);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnailVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ImageUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ImageUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BitmapSize )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CGraphics_CImaging_CBitmapSize *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_BitmapSize )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [in] */ __x_ABI_CWindows_CGraphics_CImaging_CBitmapSize value);
HRESULT ( STDMETHODCALLTYPE *SetImageAsync )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CStorage_CStreams_CIInputStream *image,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIAsyncAction **operation);
END_INTERFACE
} __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnailVtbl;
interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail
{
CONST_VTBL struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnailVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_get_TargetUri(This,value) \
( (This)->lpVtbl -> get_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_put_TargetUri(This,value) \
( (This)->lpVtbl -> put_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_get_ImageUri(This,value) \
( (This)->lpVtbl -> get_ImageUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_put_ImageUri(This,value) \
( (This)->lpVtbl -> put_ImageUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_get_BitmapSize(This,value) \
( (This)->lpVtbl -> get_BitmapSize(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_put_BitmapSize(This,value) \
( (This)->lpVtbl -> put_BitmapSize(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_SetImageAsync(This,image,operation) \
( (This)->lpVtbl -> SetImageAsync(This,image,operation) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialItemThumbnail_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0029 */
/* [local] */
#if !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_ApplicationModel_SocialInfo_ISocialUserInfo[] = L"Windows.ApplicationModel.SocialInfo.ISocialUserInfo";
#endif /* !defined(____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0029 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0029_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0029_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo */
/* [uuid][object] */
/* interface ABI::Windows::ApplicationModel::SocialInfo::ISocialUserInfo */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace ApplicationModel {
namespace SocialInfo {
MIDL_INTERFACE("9E5E1BD1-90D0-4E1D-9554-844D46607F61")
ISocialUserInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DisplayName(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DisplayName(
/* [in] */ __RPC__in HSTRING value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UserName(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_UserName(
/* [in] */ __RPC__in HSTRING value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RemoteId(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RemoteId(
/* [in] */ __RPC__in HSTRING value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetUri(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Foundation::IUriRuntimeClass **value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TargetUri(
/* [in] */ __RPC__in_opt ABI::Windows::Foundation::IUriRuntimeClass *value) = 0;
};
extern const __declspec(selectany) IID & IID_ISocialUserInfo = __uuidof(ISocialUserInfo);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DisplayName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [in] */ __RPC__in HSTRING value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UserName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_UserName )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [in] */ __RPC__in HSTRING value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RemoteId )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RemoteId )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [in] */ __RPC__in HSTRING value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass **value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TargetUri )(
__RPC__in __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CFoundation_CIUriRuntimeClass *value);
END_INTERFACE
} __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfoVtbl;
interface __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo
{
CONST_VTBL struct __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_get_DisplayName(This,value) \
( (This)->lpVtbl -> get_DisplayName(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_put_DisplayName(This,value) \
( (This)->lpVtbl -> put_DisplayName(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_get_UserName(This,value) \
( (This)->lpVtbl -> get_UserName(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_put_UserName(This,value) \
( (This)->lpVtbl -> put_UserName(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_get_RemoteId(This,value) \
( (This)->lpVtbl -> get_RemoteId(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_put_RemoteId(This,value) \
( (This)->lpVtbl -> put_RemoteId(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_get_TargetUri(This,value) \
( (This)->lpVtbl -> get_TargetUri(This,value) )
#define __x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_put_TargetUri(This,value) \
( (This)->lpVtbl -> put_TargetUri(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CApplicationModel_CSocialInfo_CISocialUserInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0030 */
/* [local] */
#ifndef RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedChildItem_DEFINED
#define RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedChildItem_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_ApplicationModel_SocialInfo_SocialFeedChildItem[] = L"Windows.ApplicationModel.SocialInfo.SocialFeedChildItem";
#endif
#ifndef RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedContent_DEFINED
#define RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedContent_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_ApplicationModel_SocialInfo_SocialFeedContent[] = L"Windows.ApplicationModel.SocialInfo.SocialFeedContent";
#endif
#ifndef RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedItem_DEFINED
#define RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedItem_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_ApplicationModel_SocialInfo_SocialFeedItem[] = L"Windows.ApplicationModel.SocialInfo.SocialFeedItem";
#endif
#ifndef RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedSharedItem_DEFINED
#define RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialFeedSharedItem_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_ApplicationModel_SocialInfo_SocialFeedSharedItem[] = L"Windows.ApplicationModel.SocialInfo.SocialFeedSharedItem";
#endif
#ifndef RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialItemThumbnail_DEFINED
#define RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialItemThumbnail_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_ApplicationModel_SocialInfo_SocialItemThumbnail[] = L"Windows.ApplicationModel.SocialInfo.SocialItemThumbnail";
#endif
#ifndef RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialUserInfo_DEFINED
#define RUNTIMECLASS_Windows_ApplicationModel_SocialInfo_SocialUserInfo_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_ApplicationModel_SocialInfo_SocialUserInfo[] = L"Windows.ApplicationModel.SocialInfo.SocialUserInfo";
#endif
/* interface __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0030 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0030_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eapplicationmodel2Esocialinfo_0000_0030_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER HSTRING_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HSTRING * );
void __RPC_USER HSTRING_UserFree( __RPC__in unsigned long *, __RPC__in HSTRING * );
unsigned long __RPC_USER HSTRING_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HSTRING * );
void __RPC_USER HSTRING_UserFree64( __RPC__in unsigned long *, __RPC__in HSTRING * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
| [
"akashche@redhat.com"
] | akashche@redhat.com |
598a128aec4b5dabbdcbbfc7174fff0f5be32e2a | 2118f611634fc050488801241f540b0be8fbea2f | /ObjectRectangle3D.h | 6019bc30f8f8e9642adc4856a9d71ac23dfa4587 | [] | no_license | valentinneagu/8-Ball-Pool-Game | 1f600db35b8c1ecc9318d532f7360e2749a142bc | fb6daf98505a9d021e1012ddefcafd836f9804b4 | refs/heads/master | 2020-05-06T13:53:25.920663 | 2019-04-08T14:04:23 | 2019-04-08T14:04:23 | 180,161,540 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 225 | h | #pragma once
#include <string>
#include <include/glm.h>
#include <Core/GPU/Mesh.h>
namespace ObjectRectangle3D
{
Mesh* CreateRectangle3D(std::string name,
float heigth, float width,
float length, glm::vec3 color);
};
| [
"daniel.neagu0109@gmail.com"
] | daniel.neagu0109@gmail.com |
100e8eba6a006e2da6be619cfd6940e72d1f977e | 4d63cfc921504ec1ae6ce2c4aa1579e941b41ee1 | /erle_classes/erle_classes63.cpp | 2bb15346a8956e7d7d53f18007d8343431770757 | [] | no_license | WitoldKaczor/cpp_repo | ca9891060b3600173b7e66e96dcfdc957fdc7946 | ca766c15a323d736e20a9b5bfcadbde990efb302 | refs/heads/master | 2022-09-24T16:06:52.734690 | 2020-06-07T15:57:26 | 2020-06-07T15:57:26 | 254,033,583 | 0 | 0 | null | 2020-04-08T09:08:38 | 2020-04-08T08:48:00 | null | UTF-8 | C++ | false | false | 213 | cpp | #include <iostream>
//Take input in variable and display same value by pointer.
int main()
{
int var;
std::cin>>var;
int* ptr = &var;
std::cout<<"var "<< *ptr << " in address " << ptr;
} | [
"63341757+WitoldKaczor@users.noreply.github.com"
] | 63341757+WitoldKaczor@users.noreply.github.com |
95ed52c35fab0f1bd85f9fbe6ac6bca205fb9484 | 24bc4990e9d0bef6a42a6f86dc783785b10dbd42 | /ash/quick_pair/repository/fast_pair/device_address_map.h | 5ceb261bba62bf5fe3fef1d350d757480c84e157 | [
"BSD-3-Clause"
] | permissive | nwjs/chromium.src | 7736ce86a9a0b810449a3b80a4af15de9ef9115d | 454f26d09b2f6204c096b47f778705eab1e3ba46 | refs/heads/nw75 | 2023-08-31T08:01:39.796085 | 2023-04-19T17:25:53 | 2023-04-19T17:25:53 | 50,512,158 | 161 | 201 | BSD-3-Clause | 2023-05-08T03:19:09 | 2016-01-27T14:17:03 | null | UTF-8 | C++ | false | false | 3,526 | h | // Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_QUICK_PAIR_REPOSITORY_FAST_PAIR_DEVICE_ADDRESS_MAP_H_
#define ASH_QUICK_PAIR_REPOSITORY_FAST_PAIR_DEVICE_ADDRESS_MAP_H_
#include <string>
#include "ash/quick_pair/common/device.h"
#include "base/containers/flat_map.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
namespace ash::quick_pair {
// Saves a mapping from mac address to model ID. Provides methods to persist
// or evict mac address -> model ID records from local state prefs. Also
// provides convenience methods for adding to the mapping given a device.
class DeviceAddressMap {
public:
// TODO(235117226): Migrate this pref to clear old entries/make sense with
// renaming.
static constexpr char kDeviceAddressMapPref[] = "fast_pair.device_id_map";
// Registers preferences used by this class in the provided |registry|.
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
DeviceAddressMap();
DeviceAddressMap(const DeviceAddressMap&) = delete;
DeviceAddressMap& operator=(const DeviceAddressMap&) = delete;
~DeviceAddressMap();
// Saves mac address -> model ID records for the devices for both
// the BLE and Classic address in memory, stored in mac_address_to_model_id.
bool SaveModelIdForDevice(scoped_refptr<Device> device);
// Persists the mac address -> model ID records for |device|
// to local state prefs. Returns true if a record was persisted, false
// otherwise.
bool PersistRecordsForDevice(scoped_refptr<Device> device);
// Evicts the |mac_address| -> model ID record in mac_address_to_model_id_
// from local state prefs. Returns true if the record was evicted, false if
// there was no |mac_address| record to evict.
bool EvictMacAddressRecord(const std::string& mac_address);
// Returns the model ID for |mac_address|, or absl::nullopt if a matching
// model ID isn't found.
absl::optional<const std::string> GetModelIdForMacAddress(
const std::string& mac_address);
// Returns true if there are mac address -> |model_id| records in
// local state prefs, false otherwise.
bool HasPersistedRecordsForModelId(const std::string& model_id);
private:
FRIEND_TEST_ALL_PREFIXES(FastPairRepositoryImplTest, PersistDeviceImages);
FRIEND_TEST_ALL_PREFIXES(FastPairRepositoryImplTest,
PersistDeviceImagesNoMacAddress);
FRIEND_TEST_ALL_PREFIXES(FastPairRepositoryImplTest, EvictDeviceImages);
// Persists the |mac_address| -> model ID record in mac_address_to_model_id_
// to local state prefs. Returns true if the record was persisted, false
// if no record exists for |mac_address| or there was an error when
// persisting.
bool PersistMacAddressRecord(const std::string& mac_address);
// Loads mac address -> model ID records persisted in prefs to
// mac_address_to_model_id_.
void LoadPersistedRecordsFromPrefs();
// Clears the in-memory map and reloads from prefs. Used by tests.
void RefreshCacheForTest();
// Used to lazily load saved records from prefs.
bool loaded_records_from_prefs_ = false;
base::flat_map<std::string, std::string> mac_address_to_model_id_;
base::WeakPtrFactory<DeviceAddressMap> weak_ptr_factory_{this};
};
} // namespace ash::quick_pair
#endif // ASH_QUICK_PAIR_REPOSITORY_FAST_PAIR_DEVICE_ADDRESS_MAP_H_
| [
"roger@nwjs.io"
] | roger@nwjs.io |
7b4abfec60395aa1f6d5fa07625bae0e56c95426 | 935fe8418680e02c35e0300cd3824d69eaa01772 | /lab1/q5.cpp | 485ab8e20fddd31d01c857891f87f5cdace49906 | [] | no_license | rlim/221 | 0dd7b1f9cf052f6023e9f20cf29afe59ceaa37b0 | 0b5fd94f205b6ad9e1bffc958a3dcc8886a26e12 | refs/heads/master | 2021-01-01T03:56:28.193566 | 2016-05-11T20:38:09 | 2016-05-11T20:38:09 | 58,578,510 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 519 | cpp | #include<iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{ bool a = true;
while (a) {
int num;
cout << "Enter a number" << endl;
cin >> num;
srand(time(NULL));
int randomNum = rand()%20;
if (randomNum == num) {
a = false;
}
else {
cout << "That's the wrong number the number is " << randomNum << " " << endl;
cout << "Do you want to continue? [y/n]" << endl;
string yn;
cin >> yn;
if(yn == "N"| yn == "n") {
return 0;
}
}
}
return 0;
}
| [
"ryanlim91@hotmail.com"
] | ryanlim91@hotmail.com |
bc9f5d8c584bfded58c6f3fb0de21b3910950527 | 169eaede72ea9e7cc208312d9cfa69a5529685b0 | /queen.h | 42a4a879b2f6f4c1005c5af39f4ee7539f02917f | [] | no_license | sdiwanji/chess-game | bbe15e0e8801ba1c651fa9c5485449d2cbda63dc | 2df471f8febf96a1966533a4c82e8791828b30af | refs/heads/master | 2020-12-03T05:09:08.551906 | 2017-06-29T05:01:28 | 2017-06-29T05:01:28 | 95,738,586 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,240 | h | //
// queen.h
// chess-game
//
// Created by Shaan Diwanji on 5/24/17.
// Copyright © 2017 Shaan Diwanji. All rights reserved.
//
#ifndef queen_h
#define queen_h
#include <cstdlib>
#include <string>
#include "coords.h"
using namespace std;
class queen: public piece{
private:
vector <coords> opts;
public:
queen(int player_number, int x_p, int y_p){
coord.x = x_p;
coord.y = y_p;
player_num = player_number;
}
vector<coords> move_opts(piece * left, piece * right, piece * down, piece * up , piece * left_up, piece * right_up, piece * left_down, piece * right_down, bool lu_b, bool ru_b, bool ld_b, bool rd_b){ // requires knowledge of position of other pieces
vector<coords> ret_vec;
// copied from bishop
coords c_lu, c_ru, c_ld, c_rd;
c_lu = coord;
c_ru = coord;
c_ld = coord;
c_rd = coord;
if (lu_b && left_up){
while (c_lu.x > left_up->coord.x + 1 && c_lu.y < left_up->coord.y - 1){
--c_lu.x;
++c_lu.y;
ret_vec.push_back(c_lu);
}
} else {
while (c_lu.x > 0 && c_lu.y < 7){
--c_lu.x;
++c_lu.y;
ret_vec.push_back(c_lu);
}
}
if (ru_b && right_up){
while (c_ru.x < right_up->coord.x - 1 && c_ru.y < right_up->coord.y - 1){
++c_ru.x;
++c_ru.y;
ret_vec.push_back(c_ru);
}
} else {
while (c_ru.x < 7 && c_ru.y < 7){
++c_ru.x;
++c_ru.y;
ret_vec.push_back(c_ru);
}
}
if (ld_b && left_down){
while (c_ld.x > left_down->coord.x + 1 && c_ld.y > left_down->coord.y + 1){
--c_ld.x;
--c_ld.y;
ret_vec.push_back(c_ld);
}
} else {
while (c_ld.x > 0 && c_ld.y > 0){
--c_ld.x;
--c_ld.y;
ret_vec.push_back(c_ld);
}
}
if (rd_b && right_down){
while (c_rd.x < right_down->coord.x - 1 && c_rd.y > right_down->coord.y + 1){
++c_rd.x;
--c_rd.y;
ret_vec.push_back(c_rd);
}
} else {
while (c_rd.y > 0 && c_rd.x < 7){
++c_rd.x;
--c_rd.y;
ret_vec.push_back(c_rd);
}
}
if (left_up && left_up->player_num != this->player_num){
c_lu.x = left_up->coord.x;
c_lu.y = left_up->coord.y;
ret_vec.push_back(c_lu);
}
if (right_up && right_up->player_num != this->player_num){
c_ru.x = right_up->coord.x;
c_ru.y = right_up->coord.y;
ret_vec.push_back(c_ru);
}
if (left_down && left_down->player_num != this->player_num){
c_ld.x = left_down->coord.x;
c_ld.y = left_down->coord.y;
ret_vec.push_back(c_ld);
}
if (right_down && right_down->player_num != this->player_num){
c_rd.x = right_down->coord.x;
c_rd.y = right_down->coord.y;
ret_vec.push_back(c_rd);
}
// copied from bishop
// copied from rook
coords c_left, c_right, c_up, c_down;
c_left = coord;
c_right = coord;
c_up = coord;
c_down = coord;
if (player_num == 1){
--c_left.x;
++c_right.x;
++c_up.y;
--c_down.y;
} else {
++c_left.x;
--c_right.x;
--c_up.y;
++c_down.y;
}
//left
if (left != nullptr){
if (player_num == 1){
while (c_left.x > left->coord.x){
ret_vec.push_back(c_left);
--c_left.x;
}
} else {
while (c_left.x < left->coord.x){
ret_vec.push_back(c_left);
++c_left.x;
}
}
if (left->player_num != this->player_num){
c_left.x = left->coord.x;
c_left.y = left->coord.y;
ret_vec.push_back(c_left);
}
} else {
if (player_num == 1){
while (c_left.x >= 0){
ret_vec.push_back(c_left);
--c_left.x;
}
} else {
while (c_left.x <= 7){
ret_vec.push_back(c_left);
++c_left.x;
}
}
}
//right
if (right != nullptr){
if (player_num == 1){
while (c_right.x < right->coord.x){
ret_vec.push_back(c_right);
++c_right.x;
}
} else {
while (c_right.x > right->coord.x){
ret_vec.push_back(c_right);
--c_right.x;
}
}
if (right->player_num != this->player_num){
c_right.x = right->coord.x;
c_right.y = right->coord.y;
ret_vec.push_back(c_right);
}
} else {
cout << "should enter here" << endl;
if (player_num == 1){
while (c_right.x <= 7){
ret_vec.push_back(c_right);
++c_right.x;
}
} else {
while (c_right.x >= 0){
ret_vec.push_back(c_right);
--c_right.x;
}
}
}
//down
if (down != nullptr){
cout << " shouldn't come in here";
if (player_num == 1){
while (c_down.y > down->coord.y){
ret_vec.push_back(c_down);
--c_down.y;
}
} else {
while (c_down.y < down->coord.y){
ret_vec.push_back(c_down);
++c_down.y;
}
}
if (down->player_num != this->player_num){
c_down.x = down->coord.x;
c_down.y = down->coord.y;
ret_vec.push_back(c_down);
}
} else {
cout << " should come in here";
if (player_num == 1){
while (c_down.y >= 0){
ret_vec.push_back(c_down);
--c_down.y;
}
} else {
while (c_down.y <= 7){
ret_vec.push_back(c_down);
++c_down.y;
}
}
}
//up
if (up != nullptr){
if (player_num == 1){
while (c_up.y < up->coord.y){
ret_vec.push_back(c_up);
++c_up.y;
}
} else {
while (c_up.y > up->coord.y){
ret_vec.push_back(c_up);
--c_up.y;
}
}
if (up->player_num != this->player_num){
c_up.x = up->coord.x;
c_up.y = up->coord.y;
ret_vec.push_back(c_up);
}
} else {
if (player_num == 1){
while (c_up.y <= 7){
ret_vec.push_back(c_up);
++c_up.y;
}
} else {
while (c_up.y >= 0){
ret_vec.push_back(c_up);
--c_up.y;
}
}
}
//copied from rook
opts = ret_vec;
return ret_vec;
}
void play(int opt_num){
coord = opts[opt_num];
}
coords get_coords(){
return coord;
}
virtual vector<coords> move_opts(piece * a, piece * b, piece * c, piece * d, piece * e, piece * f, piece * g, piece * h, bool x, bool y, bool z, bool xyz, bool abc, bool foo, bool bar, bool foobar) {
vector<coords> ryan;
return ryan;
}
virtual vector<coords> move_opts(piece * a, piece * b, piece * c, piece * d){
vector <coords> x;
return x;
}
virtual vector<coords> move_opts(piece * a, piece * b, piece * c, piece * d, bool x, bool y, bool z, bool xyz){
vector<coords> ryan;
return ryan;
}
~queen(){
}
};
#endif /* queen_h */
| [
"sdiwanji@umich.edu"
] | sdiwanji@umich.edu |
04be3f9855d3ef908dbb34b6dd764da2026b5c02 | 4c23be1a0ca76f68e7146f7d098e26c2bbfb2650 | /ic8h18/0.007/GC6H13 | 01732e35e2f7cdd3e14319c219922a2eb07ec830 | [] | no_license | labsandy/OpenFOAM_workspace | a74b473903ddbd34b31dc93917e3719bc051e379 | 6e0193ad9dabd613acf40d6b3ec4c0536c90aed4 | refs/heads/master | 2022-02-25T02:36:04.164324 | 2019-08-23T02:27:16 | 2019-08-23T02:27:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 838 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.007";
object GC6H13;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 7.84701e-38;
boundaryField
{
boundary
{
type empty;
}
}
// ************************************************************************* //
| [
"jfeatherstone123@gmail.com"
] | jfeatherstone123@gmail.com | |
560d290b2297672614bf6dec34b53ad89431e255 | e56d100ce7e183df367d6e969844bd84f0079dee | /wzemcmbd/CrdWzemPrd/QryWzemPrd1NJob.h | 489c1060848e37970516b6ab3bfdccfe94766716 | [
"MIT"
] | permissive | mpsitech/wzem-WhizniumSBE-Engine-Monitor | 800b556dce0212a6f9ad7fbedbff4c87d9cb5421 | 2808427d328f45ad1e842e0455565eeb1a563adf | refs/heads/master | 2022-09-29T02:41:46.253166 | 2022-09-12T20:34:28 | 2022-09-12T20:34:28 | 282,705,563 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,816 | h | /**
* \file QryWzemPrd1NJob.h
* job handler for job QryWzemPrd1NJob (declarations)
* \copyright (C) 2016-2020 MPSI Technologies GmbH
* \author Alexander Wirthmueller (auto-generation)
* \date created: 1 Dec 2020
*/
// IP header --- ABOVE
#ifndef QRYWZEMPRD1NJOB_H
#define QRYWZEMPRD1NJOB_H
// IP include.spec --- INSERT
// IP include.cust --- INSERT
#define StatAppQryWzemPrd1NJob QryWzemPrd1NJob::StatApp
#define StatShrQryWzemPrd1NJob QryWzemPrd1NJob::StatShr
#define StgIacQryWzemPrd1NJob QryWzemPrd1NJob::StgIac
/**
* QryWzemPrd1NJob
*/
class QryWzemPrd1NJob : public JobWzem {
public:
/**
* StatApp (full: StatAppQryWzemPrd1NJob)
*/
class StatApp {
public:
static void writeJSON(Json::Value& sup, std::string difftag = "", const Sbecore::uint firstcol = 1, const Sbecore::uint jnumFirstdisp = 1, const Sbecore::uint ncol = 1, const Sbecore::uint ndisp = 10);
static void writeXML(xmlTextWriter* wr, std::string difftag = "", bool shorttags = true, const Sbecore::uint firstcol = 1, const Sbecore::uint jnumFirstdisp = 1, const Sbecore::uint ncol = 1, const Sbecore::uint ndisp = 10);
};
/**
* StatShr (full: StatShrQryWzemPrd1NJob)
*/
class StatShr : public Sbecore::Block {
public:
static const Sbecore::uint NTOT = 1;
static const Sbecore::uint JNUMFIRSTLOAD = 2;
static const Sbecore::uint NLOAD = 3;
public:
StatShr(const Sbecore::uint ntot = 0, const Sbecore::uint jnumFirstload = 0, const Sbecore::uint nload = 0);
public:
Sbecore::uint ntot;
Sbecore::uint jnumFirstload;
Sbecore::uint nload;
public:
void writeJSON(Json::Value& sup, std::string difftag = "");
void writeXML(xmlTextWriter* wr, std::string difftag = "", bool shorttags = true);
std::set<Sbecore::uint> comm(const StatShr* comp);
std::set<Sbecore::uint> diff(const StatShr* comp);
};
/**
* StgIac (full: StgIacQryWzemPrd1NJob)
*/
class StgIac : public Sbecore::Block {
public:
static const Sbecore::uint JNUM = 1;
static const Sbecore::uint JNUMFIRSTLOAD = 2;
static const Sbecore::uint NLOAD = 3;
public:
StgIac(const Sbecore::uint jnum = 0, const Sbecore::uint jnumFirstload = 1, const Sbecore::uint nload = 100);
public:
Sbecore::uint jnum;
Sbecore::uint jnumFirstload;
Sbecore::uint nload;
public:
bool readJSON(const Json::Value& sup, bool addbasetag = false);
bool readXML(xmlXPathContext* docctx, std::string basexpath = "", bool addbasetag = false);
void writeJSON(Json::Value& sup, std::string difftag = "");
void writeXML(xmlTextWriter* wr, std::string difftag = "", bool shorttags = true);
std::set<Sbecore::uint> comm(const StgIac* comp);
std::set<Sbecore::uint> diff(const StgIac* comp);
};
public:
QryWzemPrd1NJob(XchgWzem* xchg, DbsWzem* dbswzem, const Sbecore::ubigint jrefSup, const Sbecore::uint ixWzemVLocale);
~QryWzemPrd1NJob();
public:
StatShr statshr;
StgIac stgiac;
ListWzemQPrd1NJob rst;
Sbecore::uint ixWzemVQrystate;
// IP vars.cust --- INSERT
public:
// IP cust --- INSERT
public:
void refreshJnum();
void rerun(DbsWzem* dbswzem, const bool call = false);
void rerun_filtSQL(std::string& sqlstr, const double preX1, const bool addwhere);
void rerun_filtSQL_append(std::string& sqlstr, bool& first);
void fetch(DbsWzem* dbswzem);
Sbecore::uint getJnumByRef(const Sbecore::ubigint ref);
Sbecore::ubigint getRefByJnum(const Sbecore::uint jnum);
WzemQPrd1NJob* getRecByJnum(const Sbecore::uint jnum);
public:
public:
void handleRequest(DbsWzem* dbswzem, ReqWzem* req);
private:
bool handleRerun(DbsWzem* dbswzem);
bool handleShow(DbsWzem* dbswzem);
public:
void handleCall(DbsWzem* dbswzem, Sbecore::Call* call);
private:
bool handleCallWzemJobMod_prdEq(DbsWzem* dbswzem, const Sbecore::ubigint jrefTrig);
bool handleCallWzemStubChgFromSelf(DbsWzem* dbswzem);
};
#endif
| [
"aw@mpsitech.com"
] | aw@mpsitech.com |
4f83b8560b30eff48d4e403cb94602e0b8a68fdc | 12cd044c57f4fb42362b28820d526e79684365f2 | /deps/fcl/include/fcl/primitive.h | 2a948c09202e543144a31ae0d39b8124806c3bcc | [
"Apache-2.0"
] | permissive | ci-group/gazebo | 29abd12997e7b8ce142c01410bdce4b46b97815f | 1e8bdf272217e74eeb49349da22a38d3275e5d72 | refs/heads/gazebo6-revolve | 2021-07-09T16:05:29.272321 | 2019-11-11T17:56:01 | 2019-11-11T17:56:01 | 82,048,176 | 3 | 2 | NOASSERTION | 2020-05-18T13:49:18 | 2017-02-15T10:22:37 | C++ | UTF-8 | C++ | false | false | 4,312 | h | /*
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/** \author Jia Pan */
#ifndef COLLISION_CHECKING_PRIMITIVE_H
#define COLLISION_CHECKING_PRIMITIVE_H
#include "fcl/BVH_internal.h"
#include "fcl/vec_3f.h"
/** \brief Main namespace */
namespace fcl
{
/** \brief Uncertainty information */
struct Uncertainty
{
Uncertainty() {}
Uncertainty(Vec3f Sigma_[3])
{
for(int i = 0; i < 3; ++i)
Sigma[i] = Sigma_[i];
preprocess();
}
/** preprocess performs the eigen decomposition on the Sigma matrix */
void preprocess()
{
matEigen(Sigma, sigma, axis);
}
/** sqrt performs the sqrt of Sigma matrix based on the eigen decomposition result, this is useful when the uncertainty matrix is initialized
* as a square variation matrix
*/
void sqrt()
{
for(int i = 0; i < 3; ++i)
{
if(sigma[i] < 0) sigma[i] = 0;
sigma[i] = std::sqrt(sigma[i]);
}
for(int i = 0; i < 3; ++i)
{
for(int j = 0; j < 3; ++j)
{
Sigma[i][j] = 0;
}
}
for(int i = 0; i < 3; ++i)
{
for(int j = 0; j < 3; ++j)
{
Sigma[i][j] += sigma[0] * axis[0][i] * axis[0][j];
Sigma[i][j] += sigma[1] * axis[1][i] * axis[1][j];
Sigma[i][j] += sigma[2] * axis[2][i] * axis[2][j];
}
}
}
/** \brief Variation matrix for uncertainty */
Vec3f Sigma[3];
/** \brief Variations along the eigen axes */
BVH_REAL sigma[3];
/** \brief eigen axes of uncertainty matrix */
Vec3f axis[3];
};
/** \brief Simple triangle with 3 indices for points */
struct Triangle
{
unsigned int vids[3];
Triangle() {}
Triangle(unsigned int p1, unsigned int p2, unsigned int p3)
{
set(p1, p2, p3);
}
inline void set(unsigned int p1, unsigned int p2, unsigned int p3)
{
vids[0] = p1; vids[1] = p2; vids[2] = p3;
}
inline unsigned int operator[](int i) const { return vids[i]; }
inline unsigned int& operator[](int i) { return vids[i]; }
};
/** \brief Simple edge with two indices for its endpoints */
struct Edge
{
unsigned int vids[2];
unsigned int fids[2];
Edge()
{
vids[0] = -1; vids[1] = -1;
fids[0] = -1; fids[1] = -1;
}
Edge(unsigned int vid0, unsigned int vid1, unsigned int fid)
{
vids[0] = vid0;
vids[1] = vid1;
fids[0] = fid;
}
/** \brief Whether two edges are the same, assuming belongs to the same object */
bool operator == (const Edge& other) const
{
return (vids[0] == other.vids[0]) && (vids[1] == other.vids[1]);
}
bool operator < (const Edge& other) const
{
if(vids[0] == other.vids[0])
return vids[1] < other.vids[1];
return vids[0] < other.vids[0];
}
};
}
#endif
| [
"nkoenig@willowgarage.com"
] | nkoenig@willowgarage.com |
b46b76677b0f990d1189ecf64b6943d21d9eb2fe | 7eb820c26cda08cdc120339103c858ab5fbbce47 | /OpenGL/OpenGLTransformation/MyItemRenderer.cpp | ff5231096bec6305512b45ba717108d424ccc620 | [] | no_license | NitinRamesh25/Sample-Projects | 767248259c767c0a75b2283d8c2755c856d61ad5 | 7f90e8c76c4475486fbeef467d7dd37d8af0b6e4 | refs/heads/master | 2023-01-30T17:00:03.254860 | 2021-06-30T03:03:52 | 2021-06-30T03:03:52 | 227,961,042 | 0 | 0 | null | 2023-01-20T22:59:33 | 2019-12-14T03:36:50 | C++ | UTF-8 | C++ | false | false | 4,375 | cpp | #include "MyItemRenderer.h"
#include "MyItem.h"
#include <QDebug>
MyItemRenderer::MyItemRenderer()
{
initializeOpenGLFunctions();
createShader();
createBuffer();
}
QOpenGLFramebufferObject* MyItemRenderer::createFramebufferObject(const QSize &size)
{
QOpenGLFramebufferObjectFormat format;
format.setSamples(4);
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
return new QOpenGLFramebufferObject(size, format);
}
void MyItemRenderer::synchronize(QQuickFramebufferObject *item)
{
auto* myItem = dynamic_cast<MyItem*>(item);
if(nullptr != myItem)
{
m_window = myItem->window();
m_size = myItem->size();
}
}
void MyItemRenderer::render()
{
glViewport(0, 0, 2 * m_size.width(), 2 * m_size.height());
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(m_shaderProgram);
glUniform4f(m_colorLocation, 1.0f, 0.0f, 0.0f, 1.0f);
applyTransform();
glBindVertexArray(m_vao);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, (void*)0);
m_window->resetOpenGLState();
}
void MyItemRenderer::createShader()
{
const char* vertexShaderSrc =
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"uniform mat4 transform;\n"
"void main()\n"
"{\n"
"gl_Position = transform * vec4(aPos, 1.0f);\n"
"}\0";
const char* fragmentShaderSrc =
"#version 330 core\n"
"out vec4 fragColor;\n"
"uniform vec4 myColor;\n"
"void main()\n"
"{\n"
"fragColor = myColor;\n"
"}\0";
GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSrc, NULL);
glCompileShader(vertexShader);
verifyShaderCompilation(vertexShader, "VertexShader");
GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSrc, NULL);
glCompileShader(fragmentShader);
verifyShaderCompilation(fragmentShader, "FragmentShader");
m_shaderProgram = glCreateProgram();
glAttachShader(m_shaderProgram, vertexShader);
glAttachShader(m_shaderProgram, fragmentShader);
glLinkProgram(m_shaderProgram);
verifyProgramLink(m_shaderProgram);
m_colorLocation = glGetUniformLocation(m_shaderProgram, "myColor");
m_transformLocation = glGetUniformLocation(m_shaderProgram, "transform");
}
void MyItemRenderer::createBuffer()
{
float vertices[] = {
-0.5f, -0.5f, 0.0f, // topLeft
-0.5f, 0.5f, 0.0f, // bottomLeft
0.5f, 0.5f, 0.0f, // bottomRight
0.5, -0.5f, 0.0f // topRight
};
unsigned int indices[] = {
0, 1, 2,
0, 2, 3
};
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);
GLuint vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
GLuint ebo;
glGenBuffers(1, &ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)(0));
glEnableVertexAttribArray(0);
}
bool MyItemRenderer::verifyShaderCompilation(GLuint shader, QString shaderName)
{
bool returnFlag = true;
int status;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if(!status)
{
returnFlag = false;
GLchar* infoLog;
glGetShaderInfoLog(shader, 1000, NULL, infoLog);
qDebug() << shaderName << " compilation failed: " << infoLog;
}
return returnFlag;
}
bool MyItemRenderer::verifyProgramLink(GLuint program)
{
bool returnFlag = true;
int status;
glGetProgramiv(program, GL_LINK_STATUS, &status);
if(!status)
{
returnFlag = false;
GLchar* infoLog;
glGetProgramInfoLog(program, 1000, NULL, infoLog);
qDebug() << "Shader Program Link Failed";
}
}
void MyItemRenderer::applyTransform()
{
QMatrix4x4 transformMatrix;
transformMatrix.setToIdentity();
transformMatrix.rotate(45, 0.0f, 0.0f, 1.0f);
transformMatrix.scale(1.0f, 1.5f);
transformMatrix.translate(0.3f, 0.2f);
glUniformMatrix4fv(m_transformLocation, 1, GL_FALSE, transformMatrix.data());
}
| [
"nitin.ramesh25@gmail.com"
] | nitin.ramesh25@gmail.com |
af655b84e39ecec4fe71cc35d5eb7ea01e2def2a | 40c9bff27086cab3a947f472dedf71ff95ef295e | /bateria.h | 02107a12e347e89d20c51b7ddd2c8386903707dd | [] | no_license | dominikrzesny/TelephoneBase | 536d67ce4093e3c5d2f53e666919e10dbf571873 | 06a405a3a692cfe4b5249329d70c136e962fa3e9 | refs/heads/master | 2022-09-08T08:42:31.690685 | 2020-05-31T13:31:01 | 2020-05-31T13:31:01 | 268,280,252 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 754 | h | #pragma once
#include <fstream>
#include <iostream>
#include <qfile.h>
#include <string>
using namespace std;
/// Podklasa telefonu
class Bateria{
private:
int poziom_naladowania; ///<Zmienna przechowujaca poziom naladowania baterii
int zywotnosc_baterii; ///< Zmienna przechowujaca zywotnosc baterii
public:
/// Domyslny konstruktor
Bateria();
/// Destruktor
~Bateria();
/// Funkcja wyswietlajaca stan baterii
string wyswietlStanBaterii();
/// Funkcja ladujaca baterie
void naladujBaterie();
/// Operator strumieniowy wyjsciowy
friend std::ostream& operator << (std::ostream &s, Bateria &bateria);
/// Operator strumieniowy wejsciowy
friend std::istream& operator >> (std::istream &s, Bateria &bateria);
};
| [
"d.rzesny@stud.elka.pw.edu.pl"
] | d.rzesny@stud.elka.pw.edu.pl |
1529d8b42e5e0fd71fb5cb334c67ef594f39b72c | d40efadec5724c236f1ec681ac811466fcf848d8 | /tags/fs2_open_3_5_3/code/mission/missiongoals.cpp | 9519daf021c7250c22135a4b57cba05feab53d91 | [] | no_license | svn2github/fs2open | 0fcbe9345fb54d2abbe45e61ef44a41fa7e02e15 | c6d35120e8372c2c74270c85a9e7d88709086278 | refs/heads/master | 2020-05-17T17:37:03.969697 | 2015-01-08T15:24:21 | 2015-01-08T15:24:21 | 14,258,345 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 48,986 | cpp | /*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/*
* $Logfile: /Freespace2/code/Mission/MissionGoals.cpp $
* $Revision: 2.2 $
* $Date: 2003-03-18 10:07:03 $
* $Author: unknownplayer $
*
* Module for working with Mission goals
*
* $Log: not supported by cvs2svn $
* Revision 2.1.2.1 2002/09/24 18:56:43 randomtiger
* DX8 branch commit
*
* This is the scub of UP's previous code with the more up to date RT code.
* For full details check previous dev e-mails
*
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
* Revision 1.4 2002/05/13 21:43:38 mharris
* A little more network and sound cleanup
*
* Revision 1.3 2002/05/10 20:42:44 mharris
* use "ifndef NO_NETWORK" all over the place
*
* Revision 1.2 2002/05/07 03:00:17 mharris
* make Goal_text static
*
* Revision 1.1 2002/05/02 18:03:10 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 15 10/27/99 5:22p Jefff
* Some coord changes for german ver
*
* 14 9/06/99 9:46p Jefff
* skip mission support
*
* 13 8/28/99 4:54p Dave
* Fixed directives display for multiplayer clients for wings with
* multiple waves. Fixed hud threat indicator rendering color.
*
* 12 8/26/99 8:51p Dave
* Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
*
* 11 8/03/99 6:21p Jefff
* fixed stupid bug with objectives screen key
*
* 10 7/29/99 2:58p Jefff
* Ingame objective screen icon key now uses normal objective icons and
* text is drawn in code.
*
* 9 7/24/99 4:19p Dave
* Fixed dumb code with briefing bitmaps. Made d3d zbuffer work much
* better. Made model code use zbuffer more intelligently.
*
* 8 7/10/99 1:44p Andsager
* Modified directives listing so that current and recently
* satisfied/failed directives stay on screen.
*
* 7 2/17/99 2:10p Dave
* First full run of squad war. All freespace and tracker side stuff
* works.
*
* 6 2/02/99 4:35p Neilk
* fixed coordinate problem where primary goals was on top of interface in
* mission briefing
*
* 5 1/30/99 5:08p Dave
* More new hi-res stuff.Support for nice D3D textures.
*
* 4 11/05/98 5:55p Dave
* Big pass at reducing #includes
*
* 3 10/13/98 9:28a Dave
* Started neatening up freespace.h. Many variables renamed and
* reorganized. Added AlphaColors.[h,cpp]
*
* 2 10/07/98 10:53a Dave
* Initial checkin.
*
* 1 10/07/98 10:49a Dave
*
* 127 9/15/98 11:44a Dave
* Renamed builtin ships and wepaons appropriately in FRED. Put in scoring
* scale factors. Fixed standalone filtering of MD missions to non-MD
* hosts.
*
* 126 6/09/98 10:31a Hoffoss
* Created index numbers for all xstr() references. Any new xstr() stuff
* added from here on out should be added to the end if the list. The
* current list count can be found in FreeSpace.cpp (search for
* XSTR_SIZE).
*
* 125 5/21/98 2:47a Lawrance
* Fix some problems with event music
*
* 124 4/15/98 9:05a Allender
* fix skpping of training mission with branchs
*
* 123 4/08/98 10:34p Allender
* make threat indicators work in multiplayer. Fix socket problem (once
* and for all???)
*
* 122 4/03/98 2:47p Allender
* made directives act different when multiple waves of a wing take a long
* time to reappear
*
* 121 4/01/98 9:21p John
* Made NDEBUG, optimized build with no warnings or errors.
*
* 120 3/31/98 5:18p John
* Removed demo/save/restore. Made NDEBUG defined compile. Removed a
* bunch of debug stuff out of player file. Made model code be able to
* unload models and malloc out only however many models are needed.
*
*
* 119 3/31/98 4:42p Allender
* mission objective support for team v. team mode. Chatbox changes to
* make input box be correct length when typing
*
* 118 3/23/98 1:39p Hoffoss
* Fixed bug where long objects weren't being split at the right point.
*
* 117 3/17/98 12:40a Lawrance
* Add missing struct members to state
*
* 116 3/09/98 4:24p Lawrance
* Don't play directive sound effect if gauge is disabled
*
* 115 3/04/98 5:51p Hoffoss
* Fixed warning
*
* 114 3/02/98 9:30p Allender
* make sexpression evaluation for arrivals/departures and goals happen
* every frame
*
* 113 3/02/98 10:08a Hoffoss
* Fixed bugs in saving/restoring state.
*
* 112 2/27/98 4:37p Hoffoss
* Combined Objectives screen into Mission Log screen.
*
* 111 2/26/98 10:07p Hoffoss
* Rewrote state saving and restoring to fix bugs and simplify the code.
*
* 110 2/23/98 3:06p Hoffoss
* Made objectives with only one target not show the [1] thing after it.
*
* 109 2/22/98 4:30p John
* More string externalization classification
*
* 108 2/22/98 12:19p John
* Externalized some strings
*
* 107 2/20/98 8:33p Lawrance
* Added mission_goals_incomplete()
*
* 106 2/06/98 12:12a Lawrance
* Play sound effect when continue is pressed.
*
* 105 2/05/98 10:14p Lawrance
* Implement Save and Quit
*
* 104 2/04/98 4:32p Allender
* support for multiple briefings and debriefings. Changes to mission
* type (now a bitfield). Bitfield defs for multiplayer modes
*
* 103 1/30/98 4:24p Hoffoss
* Added a 3 second delay for directives before they get displayed.
*
* 102 1/29/98 10:26a Hoffoss
* Made changes so arrow buttons repeat scrolling when held down.
*
* 101 1/28/98 6:19p Dave
* Reduced standalone memory usage ~8 megs. Put in support for handling
* multiplayer submenu handling for endgame, etc.
*
* 100 1/27/98 11:00a Lawrance
* Fix bug with showing number of resolved goals in the objective status
* popup.
*
* 99 1/27/98 10:56a Allender
* slight changes to scoring stuff. Added work for Baranec :-)
*
* 98 1/26/98 10:02p Allender
* some scoring stuff
*
* 97 1/20/98 2:26p Hoffoss
* Removed references to timestamp_ticker, used timestamp() instead.
*
* 96 1/19/98 9:37p Allender
* Great Compiler Warning Purge of Jan, 1998. Used pragma's in a couple
* of places since I was unsure of what to do with code.
*
* 95 1/15/98 5:23p Lawrance
* Add HUD gauge to indicate completed objectives.
*
* 94 1/15/98 1:29p Hoffoss
* Made chained events only check next event if that event is also
* chained.
*
* 93 1/13/98 5:37p Dave
* Reworked a lot of standalone interface code. Put in single and
* multiplayer popups for death sequence. Solidified multiplayer kick
* code.
*
* 92 1/12/98 5:17p Allender
* fixed primary fired problem and ship warp out problem. Made new
* mission goal info packet to deal with goals more accurately.
*
* 91 1/11/98 10:02p Allender
* removed <winsock.h> from headers which included it. Made psnet_socket
* type which is defined just as SOCKET type is.
*
* 90 1/10/98 1:14p John
* Added explanation to debug console commands
*
* 89 1/08/98 10:26a Lawrance
* Delay directive success sound effect about 1/2 second.
*
* 88 1/07/98 6:46p Lawrance
* If a goal is invalid, ignore it when evaluating mission success.
*
* 87 1/07/98 11:09a Lawrance
* Add sound hook for when directive gets completed.
*
* 86 1/02/98 3:07p Hoffoss
* Changed sexp evaluation to every half second.
*
* 85 12/27/97 8:08p Lawrance
* get savegames working again
*
* 84 12/26/97 10:02p Lawrance
* Add event music for when goals fail.
*
* 83 12/22/97 6:07p Hoffoss
* Made directives flash when completed, fixed but with is-destroyed
* operator.
*
* 82 12/21/97 4:33p John
* Made debug console functions a class that registers itself
* automatically, so you don't need to add the function to
* debugfunctions.cpp.
*
* 81 12/19/97 12:43p Hoffoss
* Changed code to allow counts in directives.
*
* 80 12/15/97 5:26p Allender
* temporary code to display for 5 second completion status of objectives
*
* 79 12/03/97 4:16p Hoffoss
* Changed sound stuff used in interface screens for interface purposes.
*
* 78 12/03/97 11:35a Hoffoss
* Made changes to HUD messages send throughout the game.
*
* 77 12/02/97 10:47a Hoffoss
* Changed mention of goals to objectives.
*
* 76 12/01/97 12:26a Lawrance
* Add flag MGF_NO_MUSIC to mission_goal struct, to avoid playing music
* for certain goals
*
* 75 11/21/97 2:16p Allender
* debug keys to mark all goals (p/s/b) as satisfied
*
* 74 11/17/97 11:45a Johnson
* when marking goals false, add log entry. Be sure that "delay" function
* check for equal to delay as well
*
* 73 11/13/97 10:16p Hoffoss
* Added icons to mission log scrollback.
*
* 72 11/13/97 4:05p Hoffoss
* Added hiding code for mission log entries.
*
* 71 11/05/97 7:11p Hoffoss
* Made changed to the hud message system. Hud messages can now have
* sources so they can be color coded.
*
* 70 11/02/97 10:09p Lawrance
* add missing fields from mission_event to save/restore
*
* 69 10/31/97 4:28p Allender
* fail all incomplete mission goals when mission is over
*
* 68 10/29/97 11:06a Jasen
* eval goals/events every 1.75 seconds instead of every 2.5 seconds for
* slightly more accurate timing of events
*
* 67 10/28/97 10:05a Allender
* added function to mark all goals as failed
*
* 66 10/28/97 9:33a Lawrance
* change 'Alt-Q' in HUD message to use text for bound key
*
* 65 10/27/97 5:03p Hoffoss
* Fixed comment.
*
* 64 10/23/97 2:16p Johnson
* make pointers point to NULl after freeing to prevent problems when
* tried to free multiple times
*
* 63 10/16/97 2:35p Hoffoss
* Enhanced the mission goals screen a little.
*
* 62 10/16/97 1:28p Hoffoss
* New mission goals screen implemented.
*
* 61 10/10/97 6:15p Hoffoss
* Implemented a training objective list display.
*
* 60 10/09/97 4:44p Hoffoss
* Dimmed training window glass and made it less transparent, added flags
* to events, set he stage for detecting current events.
*
* 59 10/06/97 4:11p Lawrance
* add missing field from mission_events to save/restore
*
* 58 10/03/97 4:14p Hoffoss
* Augmented event debug view code.
*
* 57 9/30/97 10:01a Hoffoss
* Added event chaining support to Fred and FreeSpace.
*
* 56 9/29/97 1:58p Hoffoss
* Need to check in changes so I can get merged code to continue working
* on event chaining code.
*
*/
#include "freespace2/freespace.h"
#include "object/object.h"
#include "mission/missiongoals.h"
#include "mission/missionparse.h"
#include "mission/missionlog.h"
#include "mission/missiontraining.h"
#include "missionui/missionscreencommon.h"
#include "gamesequence/gamesequence.h"
#include "hud/hud.h"
#include "io/key.h"
#include "graphics/2d.h"
#include "io/timer.h"
#include "globalincs/linklist.h"
#include "ship/ship.h"
#include "ship/ai.h"
#include "parse/parselo.h"
#include "parse/sexp.h"
#include "gamesnd/eventmusic.h"
#include "network/stand_gui.h"
#include "ui/ui.h"
#include "bmpman/bmpman.h"
#include "sound/sound.h"
#include "gamesnd/gamesnd.h"
#include "globalincs/alphacolors.h"
#include "playerman/player.h"
#include "debugconsole/dbugfile.h"
#ifndef NO_NETWORK
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multi_team.h"
#endif
// timestamp stuff for evaluating mission goals
#define GOAL_TIMESTAMP 0 // make immediately eval
#define GOAL_TIMESTAMP_TRAINING 500 // every half second
#define MAX_GOALS_PER_LIST 15
#define MAX_GOAL_LINES 200
// indicies for coordinates
#define GOAL_SCREEN_X_COORD 0
#define GOAL_SCREEN_Y_COORD 1
#define GOAL_SCREEN_W_COORD 2
#define GOAL_SCREEN_H_COORD 3
/*
#define GOAL_SCREEN_TEXT_X 81
#define GOAL_SCREEN_TEXT_Y 95
#define GOAL_SCREEN_TEXT_W 385
#define GOAL_SCREEN_TEXT_H 299
#define GOAL_SCREEN_ICON_X 45
*/
static int Goal_screen_text_coords[GR_NUM_RESOLUTIONS][4] = {
{
81,95,385,299 // GR_640
},
{
130,152,385,299 // GR_1024
}
};
static int Goal_screen_icon_xcoord[GR_NUM_RESOLUTIONS] = {
45, // GR_640
72 // GR_1024
};
#if defined(GERMAN_BUILD)
// german version gets slightly diff coords
static int Objective_key_text_coords[GR_NUM_RESOLUTIONS][3][2] = {
{
// GR_640
{175, 344},
{316, 344},
{432, 344}
},
{
// GR_1024
{310, 546},
{536, 546},
{688, 546}
}
};
static int Objective_key_icon_coords[GR_NUM_RESOLUTIONS][3][2] = {
{
// GR_640
{150, 339},
{290, 339},
{406, 339}
},
{
// GR_1024
{272, 542},
{498, 542},
{650, 542}
}
};
#else
static int Objective_key_text_coords[GR_NUM_RESOLUTIONS][3][2] = {
{
// GR_640
{195, 344},
{306, 344},
{432, 344}
},
{
// GR_1024
{310, 546},
{486, 546},
{688, 546}
}
};
static int Objective_key_icon_coords[GR_NUM_RESOLUTIONS][3][2] = {
{
// GR_640
{170, 339},
{280, 339},
{406, 339}
},
{
// GR_1024
{272, 542},
{448, 542},
{650, 542}
}
};
#endif
#define NUM_GOAL_SCREEN_BUTTONS 3 // total number of buttons
#define GOAL_SCREEN_BUTTON_SCROLL_UP 0
#define GOAL_SCREEN_BUTTON_SCROLL_DOWN 1
#define GOAL_SCREEN_BUTTON_RETURN 2
struct goal_list {
int count;
mission_goal *list[MAX_GOALS_PER_LIST];
int line_offsets[MAX_GOALS_PER_LIST];
int line_spans[MAX_GOALS_PER_LIST];
goal_list() : count(0) {}
void add(mission_goal *m);
void set();
void icons_display(int y);
};
struct goal_buttons {
char *filename;
int x, y;
int hotspot;
UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
goal_buttons(char *name, int x1, int y1, int h) : filename(name), x(x1), y(y1), hotspot(h) {}
};
struct goal_text {
int m_num_lines;
int m_line_sizes[MAX_GOAL_LINES];
char *m_lines[MAX_GOAL_LINES];
void init();
int add(char *text = NULL);
void display(int n, int y);
};
int Num_mission_events;
int Num_goals = 0; // number of goals for this mission
int Event_index; // used by sexp code to tell what event it came from
int Mission_goal_timestamp;
mission_event Mission_events[MAX_MISSION_EVENTS];
mission_goal Mission_goals[MAX_GOALS]; // structure for the goals of this mission
static goal_text Goal_text;
#define DIRECTIVE_SOUND_DELAY 500 // time directive success sound effect is delayed
#define DIRECTIVE_SPECIAL_DELAY 7000 // mark special directives as true after 7 seconds
static int Mission_directive_sound_timestamp; // timestamp to control when directive succcess sound gets played
static int Mission_directive_special_timestamp; // used to specially mark a directive as true even though it's not
char *Goal_type_text(int n)
{
switch (n) {
case 0:
return XSTR( "Primary", 396);
case 1:
return XSTR( "Secondary", 397);
case 2:
return XSTR( "Bonus", 398);
}
return NULL;
};
static int Goal_screen_text_x;
static int Goal_screen_text_y;
static int Goal_screen_text_w;
static int Goal_screen_text_h;
static int Goal_screen_icon_x;
static goal_list Primary_goal_list;
static goal_list Secondary_goal_list;
static goal_list Bonus_goal_list;
static int Scroll_offset;
static int Goals_screen_bg_bitmap;
static int Goal_complete_bitmap;
static int Goal_incomplete_bitmap;
static int Goal_failed_bitmap;
static UI_WINDOW Goals_screen_ui_window;
goal_buttons Goal_buttons[NUM_GOAL_SCREEN_BUTTONS] = {
//XSTR:OFF
goal_buttons("MOB_00", 475, 288, 0),
goal_buttons("MOB_01", 475, 336, 1),
goal_buttons("MOB_02", 553, 409, 2),
//XSTR:ON
};
void goal_screen_button_pressed(int num);
void goal_screen_scroll_up();
void goal_screen_scroll_down();
//
/// goal_list structure functions
//
void goal_list::add(mission_goal *m)
{
Assert(count < MAX_GOALS_PER_LIST);
list[count++] = m;
}
void goal_list::set()
{
int i;
for (i=0; i<count; i++) {
line_offsets[i] = Goal_text.m_num_lines;
line_spans[i] = Goal_text.add(list[i]->message);
if (i < count - 1)
Goal_text.add();
}
}
void goal_list::icons_display(int yoff)
{
int i, y, ys, bmp, font_height;
font_height = gr_get_font_height();
for (i=0; i<count; i++) {
y = line_offsets[i] - yoff;
bmp = -1; // initialize for safety.
switch (list[i]->satisfied) {
case GOAL_COMPLETE:
bmp = Goal_complete_bitmap;
break;
case GOAL_INCOMPLETE:
bmp = Goal_incomplete_bitmap;
break;
case GOAL_FAILED:
bmp = Goal_failed_bitmap;
break;
}
if (bmp >= 0) {
bm_get_info(bmp, NULL, &ys, NULL);
y = Goal_screen_text_y // offset of text window on screen
+ y * font_height // relative line position offset
+ line_spans[i] * font_height / 2 // center of text offset
- ys / 2; // center of icon offest
if ((y >= Goal_screen_text_y - ys / 2) && (y + ys <= Goal_screen_text_y + Goal_screen_text_h + ys / 2)) {
gr_set_bitmap(bmp);
gr_bitmap(Goal_screen_icon_x, y);
}
}
}
}
//
/// goal_text structure functions
//
// initializes the goal text struct (empties it out)
void goal_text::init()
{
m_num_lines = 0;
}
// Adds lines of goal text. If passed NULL (or nothing passed) a blank line is added. If
// the text is too long, it is automatically split into more than one line.
// Returns the number of lines added.
int goal_text::add(char *text)
{
int max, count;
max = MAX_GOAL_LINES - m_num_lines;
if (max < 1) {
Error(LOCATION, "Goal text space exhausted");
return 0;
}
if (!text) {
m_lines[m_num_lines] = NULL;
m_line_sizes[m_num_lines++] = 0;
return 1;
}
count = split_str(text, Goal_screen_text_w - Goal_screen_text_coords[gr_screen.res][GOAL_SCREEN_X_COORD] + Goal_screen_icon_xcoord[gr_screen.res], m_line_sizes + m_num_lines, m_lines + m_num_lines, max);
m_num_lines += count;
return count;
}
// Display a line of goal text
// n = goal text line number
// y = y offset to draw relative to goal text area top
void goal_text::display(int n, int y)
{
int y1, w, h;
char buf[MAX_GOAL_TEXT];
if ((n < 0) || (n >= m_num_lines) || (m_line_sizes[n] < 1))
return; // out of range, don't draw anything
Assert(m_line_sizes[n] < MAX_GOAL_TEXT);
y += Goal_screen_text_y;
if (*m_lines[n] == '*') { // header line
gr_set_color_fast(&Color_text_heading);
strncpy(buf, m_lines[n] + 1, m_line_sizes[n] - 1);
buf[m_line_sizes[n] - 1] = 0;
gr_get_string_size(&w, &h, buf);
y1 = y + h / 2 - 1;
gr_line(Goal_screen_icon_x, y1, Goal_screen_text_x - 2, y1);
gr_line(Goal_screen_text_x + w + 1, y1, Goal_screen_icon_x + Goal_screen_text_w, y1);
} else {
gr_set_color_fast(&Color_text_normal);
strncpy(buf, m_lines[n], m_line_sizes[n]);
buf[m_line_sizes[n]] = 0;
}
gr_printf(Goal_screen_text_x, y, buf);
}
// mission_init_goals: initializes info for goals. Called as part of mission initialization.
void mission_init_goals()
{
int i;
Num_goals = 0;
for (i=0; i<MAX_GOALS; i++) {
Mission_goals[i].satisfied = GOAL_INCOMPLETE;
Mission_goals[i].flags = 0;
Mission_goals[i].team = 0;
}
Num_mission_events = 0;
for (i=0; i<MAX_MISSION_EVENTS; i++) {
Mission_events[i].result = 0;
Mission_events[i].flags = 0;
Mission_events[i].count = 0;
Mission_events[i].satisfied_time = 0;
Mission_events[i].born_on_date = 0;
Mission_events[i].team = -1;
}
Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP);
Mission_directive_sound_timestamp = 0;
Mission_directive_special_timestamp = timestamp(-1); // need to make invalid right away
}
// called at the end of a mission for cleanup
void mission_event_shutdown()
{
int i;
for (i=0; i<Num_mission_events; i++) {
if (Mission_events[i].objective_text) {
free(Mission_events[i].objective_text);
Mission_events[i].objective_text = NULL;
}
if (Mission_events[i].objective_key_text) {
free(Mission_events[i].objective_key_text);
Mission_events[i].objective_key_text = NULL;
}
}
}
// called once right before entering the show goals screen to do initializations.
void mission_show_goals_init()
{
int i, type, team_num=0; // JAS: I set team_num to 0 because it was used without being initialized.
goal_buttons *b;
Scroll_offset = 0;
Primary_goal_list.count = 0;
Secondary_goal_list.count = 0;
Bonus_goal_list.count = 0;
Goal_screen_text_x = Goal_screen_text_coords[gr_screen.res][GOAL_SCREEN_X_COORD];
Goal_screen_text_y = Goal_screen_text_coords[gr_screen.res][GOAL_SCREEN_Y_COORD];
Goal_screen_text_w = Goal_screen_text_coords[gr_screen.res][GOAL_SCREEN_W_COORD];
Goal_screen_text_h = Goal_screen_text_coords[gr_screen.res][GOAL_SCREEN_H_COORD];
Goal_screen_icon_x = Goal_screen_icon_xcoord[gr_screen.res];
// fill up the lists so we can display the goals appropriately
for (i=0; i<Num_goals; i++) {
if (Mission_goals[i].type & INVALID_GOAL){ // don't count invalid goals here
continue;
}
if ( (Game_mode & GM_MULTIPLAYER) && (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) && (Mission_goals[i].team != team_num) ){
continue;
}
type = Mission_goals[i].type & GOAL_TYPE_MASK;
switch (type) {
case PRIMARY_GOAL:
Primary_goal_list.add(&Mission_goals[i]);
break;
case SECONDARY_GOAL:
Secondary_goal_list.add(&Mission_goals[i]);
break;
case BONUS_GOAL:
if (Mission_goals[i].satisfied == GOAL_COMPLETE){
Bonus_goal_list.add(&Mission_goals[i]);
}
break;
default:
Error(LOCATION, "Unknown goal priority encountered when displaying goals in mission\n");
break;
} // end switch
} // end for
Goal_text.init();
Goal_text.add(XSTR( "*Primary Objectives", 399));
Goal_text.add();
Primary_goal_list.set();
if (Secondary_goal_list.count) {
Goal_text.add();
Goal_text.add();
Goal_text.add(XSTR( "*Secondary Objectives", 400));
Goal_text.add();
Secondary_goal_list.set();
}
if (Bonus_goal_list.count) {
Goal_text.add();
Goal_text.add();
Goal_text.add(XSTR( "*Bonus Objectives", 401));
Goal_text.add();
Bonus_goal_list.set();
}
common_set_interface_palette("ObjectivesPalette"); // set the interface palette
Goals_screen_ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
Goals_screen_ui_window.set_mask_bmap("Objectives-m");
for (i=0; i<NUM_GOAL_SCREEN_BUTTONS; i++) {
b = &Goal_buttons[i];
b->button.create(&Goals_screen_ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
// set up callback for when a mouse first goes over a button
b->button.set_highlight_action(common_play_highlight_sound);
b->button.set_bmaps(b->filename);
b->button.link_hotspot(b->hotspot);
}
// set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
Goal_buttons[GOAL_SCREEN_BUTTON_SCROLL_UP].button.set_hotkey(KEY_UP);
Goal_buttons[GOAL_SCREEN_BUTTON_SCROLL_DOWN].button.set_hotkey(KEY_DOWN);
Goals_screen_bg_bitmap = bm_load("ObjectivesBG");
Goal_complete_bitmap = bm_load("ObjComp");
Goal_incomplete_bitmap = bm_load("ObjIncomp");
Goal_failed_bitmap = bm_load("ObjFail");
// if (Goal_incomplete_bitmap < 0) Int3();
if (Goals_screen_bg_bitmap < 0) {
Warning(LOCATION, "Could not load the background bitmap: ObjectivesBG.pcx");
}
}
// cleanup called when exiting the show goals screen
void mission_show_goals_close()
{
if (Goals_screen_bg_bitmap >= 0)
bm_unload(Goals_screen_bg_bitmap);
if (Goal_complete_bitmap)
bm_unload(Goal_complete_bitmap);
if (Goal_incomplete_bitmap)
bm_unload(Goal_incomplete_bitmap);
if (Goal_failed_bitmap)
bm_unload(Goal_failed_bitmap);
Goals_screen_ui_window.destroy();
common_free_interface_palette(); // restore game palette
game_flush();
}
// called once a frame during show goals state to process events and render the screen
void mission_show_goals_do_frame(float frametime)
{
int k, i, y, z;
int font_height = gr_get_font_height();
k = Goals_screen_ui_window.process();
switch (k) {
case KEY_ESC:
mission_goal_exit();
break;
case KEY_DOWN:
goal_screen_scroll_down();
break;
case KEY_UP:
goal_screen_scroll_up();
break;
default:
// do nothing
break;
} // end switch
for (i=0; i<NUM_GOAL_SCREEN_BUTTONS; i++){
if (Goal_buttons[i].button.pressed()){
goal_screen_button_pressed(i);
}
}
GR_MAYBE_CLEAR_RES(Goals_screen_bg_bitmap);
if (Goals_screen_bg_bitmap >= 0) {
gr_set_bitmap(Goals_screen_bg_bitmap);
gr_bitmap(0, 0);
}
Goals_screen_ui_window.draw();
y = 0;
z = Scroll_offset;
while (y + font_height <= Goal_screen_text_h) {
Goal_text.display(z, y);
y += font_height;
z++;
}
Primary_goal_list.icons_display(Scroll_offset);
Secondary_goal_list.icons_display(Scroll_offset);
Bonus_goal_list.icons_display(Scroll_offset);
gr_flip();
}
// Mission Log Objectives subscreen init.
// Called once right before entering the Mission Log screen to do initializations.
int ML_objectives_init(int x, int y, int w, int h)
{
int i, type, team_num;
Primary_goal_list.count = 0;
Secondary_goal_list.count = 0;
Bonus_goal_list.count = 0;
Goal_screen_text_x = x - Goal_screen_icon_xcoord[gr_screen.res] + Goal_screen_text_coords[gr_screen.res][GOAL_SCREEN_X_COORD];
Goal_screen_text_y = y;
Goal_screen_text_w = w;
Goal_screen_text_h = h;
Goal_screen_icon_x = x;
team_num = 0; // this is the default team -- we will change it if in a multiplayer team v. team game
#ifndef NO_NETWORK
if ( (Game_mode & GM_MULTIPLAYER) && (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) ){
team_num = Net_player->p_info.team;
}
#endif
// fill up the lists so we can display the goals appropriately
for (i=0; i<Num_goals; i++) {
if (Mission_goals[i].type & INVALID_GOAL){ // don't count invalid goals here
continue;
}
if ( (Game_mode & GM_MULTIPLAYER) && (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) && (Mission_goals[i].team != team_num) ){
continue;
}
type = Mission_goals[i].type & GOAL_TYPE_MASK;
switch (type) {
case PRIMARY_GOAL:
Primary_goal_list.add(&Mission_goals[i]);
break;
case SECONDARY_GOAL:
Secondary_goal_list.add(&Mission_goals[i]);
break;
case BONUS_GOAL:
if (Mission_goals[i].satisfied == GOAL_COMPLETE){
Bonus_goal_list.add(&Mission_goals[i]);
}
break;
default:
Error(LOCATION, "Unknown goal priority encountered when displaying goals in mission\n");
break;
} // end switch
} // end for
Goal_text.init();
Goal_text.add(XSTR( "*Primary Objectives", 399));
Goal_text.add();
Primary_goal_list.set();
if (Secondary_goal_list.count) {
Goal_text.add();
Goal_text.add();
Goal_text.add(XSTR( "*Secondary Objectives", 400));
Goal_text.add();
Secondary_goal_list.set();
}
if (Bonus_goal_list.count) {
Goal_text.add();
Goal_text.add();
Goal_text.add(XSTR( "*Bonus Objectives", 401));
Goal_text.add();
Bonus_goal_list.set();
}
Goal_complete_bitmap = bm_load("ObjComp");
Goal_incomplete_bitmap = bm_load("ObjIncomp");
Goal_failed_bitmap = bm_load("ObjFail");
// if (Goal_incomplete_bitmap < 0) Int3();
return Goal_text.m_num_lines;
}
// cleanup called when exiting the show goals screen
void ML_objectives_close()
{
if (Goal_complete_bitmap >= 0) {
bm_unload(Goal_complete_bitmap);
}
if (Goal_incomplete_bitmap >= 0) {
bm_unload(Goal_incomplete_bitmap);
}
if (Goal_failed_bitmap >= 0) {
bm_unload(Goal_failed_bitmap);
}
}
void ML_objectives_do_frame(int scroll_offset)
{
int y, z;
int font_height = gr_get_font_height();
y = 0;
z = scroll_offset;
while (y + font_height <= Goal_screen_text_h) {
Goal_text.display(z, y);
y += font_height;
z++;
}
Primary_goal_list.icons_display(scroll_offset);
Secondary_goal_list.icons_display(scroll_offset);
Bonus_goal_list.icons_display(scroll_offset);
}
void ML_render_objectives_key()
{
// display icon key at the bottom
gr_set_bitmap(Goal_complete_bitmap);
gr_bitmap(Objective_key_icon_coords[gr_screen.res][0][0], Objective_key_icon_coords[gr_screen.res][0][1]);
gr_set_bitmap(Goal_incomplete_bitmap);
gr_bitmap(Objective_key_icon_coords[gr_screen.res][1][0], Objective_key_icon_coords[gr_screen.res][1][1]);
gr_set_bitmap(Goal_failed_bitmap);
gr_bitmap(Objective_key_icon_coords[gr_screen.res][2][0], Objective_key_icon_coords[gr_screen.res][2][1]);
gr_string(Objective_key_text_coords[gr_screen.res][0][0], Objective_key_text_coords[gr_screen.res][0][1] , XSTR("Complete", 1437));
gr_string(Objective_key_text_coords[gr_screen.res][1][0], Objective_key_text_coords[gr_screen.res][1][1] , XSTR("Incomplete", 1438));
gr_string(Objective_key_text_coords[gr_screen.res][2][0], Objective_key_text_coords[gr_screen.res][2][1] , XSTR("Failed", 1439));
}
// temporary hook for temporarily displaying objective completion/failure
// extern void message_training_add_simple( char *text );
void mission_goal_status_change( int goal_num, int new_status)
{
int type;
Assert(goal_num < Num_goals);
Assert((new_status == GOAL_FAILED) || (new_status == GOAL_COMPLETE));
#ifndef NO_NETWORK
// if in a multiplayer game, send a status change to clients
if ( MULTIPLAYER_MASTER ){
send_mission_goal_info_packet( goal_num, new_status, -1 );
}
#endif
type = Mission_goals[goal_num].type & GOAL_TYPE_MASK;
Mission_goals[goal_num].satisfied = new_status;
if ( new_status == GOAL_FAILED ) {
// don't display bonus goal failure
if ( type != BONUS_GOAL ) {
// only do HUD and music is goals are my teams goals.
#ifndef NO_NETWORK
if ( (Game_mode & GM_NORMAL) || ((Net_player != NULL) && (Net_player->p_info.team == Mission_goals[goal_num].team)) ) {
#endif
hud_add_objective_messsage(type, new_status);
if ( !Mission_goals[goal_num].flags & MGF_NO_MUSIC ) { // maybe play event music
event_music_primary_goal_failed();
}
//HUD_sourced_printf(HUD_SOURCE_FAILED, "%s goal failed at time %6.1f!", Goal_type_text(type), f2fl(Missiontime) );
#ifndef NO_NETWORK
}
#endif
}
mission_log_add_entry( LOG_GOAL_FAILED, Mission_goals[goal_num].name, NULL, goal_num );
} else if ( new_status == GOAL_COMPLETE ) {
#ifndef NO_NETWORK
if ( (Game_mode & GM_NORMAL) || ((Net_player != NULL) && (Net_player->p_info.team == Mission_goals[goal_num].team))) {
#endif
hud_add_objective_messsage(type, new_status);
// cue for Event Music
if ( !(Mission_goals[goal_num].flags & MGF_NO_MUSIC) ) {
event_music_primary_goals_met();
}
mission_log_add_entry( LOG_GOAL_SATISFIED, Mission_goals[goal_num].name, NULL, goal_num );
#ifndef NO_NETWORK
}
if(Game_mode & GM_MULTIPLAYER){
// squad war
multi_team_maybe_add_score((int)(Mission_goals[goal_num].score * scoring_get_scale_factor()), Mission_goals[goal_num].team);
}
else
#endif
{
// deal with the score
Player->stats.m_score += (int)(Mission_goals[goal_num].score * scoring_get_scale_factor());
}
}
}
// return value:
// EVENT_UNBORN = event has yet to be available (not yet evaluatable)
// EVENT_CURRENT = current (evaluatable), but not yet true
// EVENT_SATISFIED = event has occured (true)
// EVENT_FAILED = event failed, can't possibly become true anymore
int mission_get_event_status(int event)
{
// check for directive special events first. We will always return from this part of the if statement
if ( Mission_events[event].flags & MEF_DIRECTIVE_SPECIAL ) {
// if this event is temporarily true, return as such
if ( Mission_events[event].flags & MEF_DIRECTIVE_TEMP_TRUE ){
return EVENT_SATISFIED;
}
// if the timestamp has elapsed, we can "mark" this directive as true although it's really not.
if ( timestamp_elapsed(Mission_directive_special_timestamp) ) {
Mission_events[event].satisfied_time = Missiontime;
Mission_events[event].flags |= MEF_DIRECTIVE_TEMP_TRUE;
}
return EVENT_CURRENT;
} else if (Mission_events[event].flags & MEF_CURRENT) {
if (!Mission_events[event].born_on_date){
Mission_events[event].born_on_date = timestamp();
}
if (Mission_events[event].result) {
return EVENT_SATISFIED;
}
if (Mission_events[event].formula < 0) {
return EVENT_FAILED;
}
return EVENT_CURRENT;
}
return EVENT_UNBORN;
}
void mission_event_set_directive_special(int event)
{
// bogus
if((event < 0) || (event >= Num_mission_events)){
return;
}
Mission_events[event].flags |= MEF_DIRECTIVE_SPECIAL;
// start from a known state
Mission_events[event].flags &= ~MEF_DIRECTIVE_TEMP_TRUE;
Mission_directive_special_timestamp = timestamp(DIRECTIVE_SPECIAL_DELAY);
}
void mission_event_unset_directive_special(int event)
{
// bogus
if((event < 0) || (event >= Num_mission_events)){
return;
}
Mission_events[event].flags &= ~(MEF_DIRECTIVE_SPECIAL);
// this event may be marked temporarily true -- if so, then unmark this value!!!
if ( Mission_events[event].flags & MEF_DIRECTIVE_TEMP_TRUE ){
Mission_events[event].flags &= ~MEF_DIRECTIVE_TEMP_TRUE;
}
Mission_events[event].satisfied_time = 0;
Mission_directive_special_timestamp = timestamp(-1);
}
// function which evaluates and processes the given event
void mission_process_event( int event )
{
int store_flags = Mission_events[event].flags;
int store_formula = Mission_events[event].formula;
int store_result = Mission_events[event].result;
int store_count = Mission_events[event].count;
int result, sindex;
Directive_count = 0;
Event_index = event;
sindex = Mission_events[event].formula;
result = Mission_events[event].result;
// if chained, insure that previous event is true and next event is false
if (Mission_events[event].chain_delay >= 0) { // this indicates it's chained
if (event > 0){
if (!Mission_events[event - 1].result || ((fix) Mission_events[event - 1].timestamp + i2f(Mission_events[event].chain_delay) > Missiontime)){
sindex = -1; // bypass evaluation
}
}
if ((event < Num_mission_events - 1) && Mission_events[event + 1].result && (Mission_events[event + 1].chain_delay >= 0)){
sindex = -1; // bypass evaluation
}
}
if (sindex >= 0) {
Sexp_useful_number = 1;
result = eval_sexp(sindex);
// if the directive count is a special value, deal with that first. Mark the event as a special
// event, and unmark it when the directive is true again.
if ( (Directive_count == DIRECTIVE_WING_ZERO) && !(Mission_events[event].flags & MEF_DIRECTIVE_SPECIAL) ) {
// make it special - which basically just means that its true until the next wave arrives
mission_event_set_directive_special(event);
Directive_count = 0;
} else if ( (Mission_events[event].flags & MEF_DIRECTIVE_SPECIAL) && Directive_count > 1 ) {
// make it non special
mission_event_unset_directive_special(event);
}
if (Mission_events[event].count || (Directive_count > 1)){
Mission_events[event].count = Directive_count;
}
if (Sexp_useful_number){
Mission_events[event].flags |= MEF_CURRENT;
}
}
Event_index = 0;
Mission_events[event].result = result;
// if the sexpression is known false, then no need to evaluate anymore
if ((sindex >= 0) && (Sexp_nodes[sindex].value == SEXP_KNOWN_FALSE)) {
Mission_events[event].timestamp = (int) Missiontime;
Mission_events[event].satisfied_time = Missiontime;
Mission_events[event].repeat_count = -1;
Mission_events[event].formula = -1;
return;
}
if (result && !Mission_events[event].satisfied_time) {
Mission_events[event].satisfied_time = Missiontime;
if ( Mission_events[event].objective_text ) {
Mission_directive_sound_timestamp = timestamp(DIRECTIVE_SOUND_DELAY);
}
}
// decrement the repeat count. When at 0, don't eval this function anymore
if ( result || timestamp_valid(Mission_events[event].timestamp) ) {
Mission_events[event].repeat_count--;
if ( Mission_events[event].repeat_count <= 0 ) {
Mission_events[event].timestamp = (int)Missiontime;
Mission_events[event].formula = -1;
#ifndef NO_NETWORK
if(Game_mode & GM_MULTIPLAYER){
// squad war
multi_team_maybe_add_score((int)(Mission_events[event].score * scoring_get_scale_factor()), Mission_events[event].team);
}
else
#endif
{
// deal with the player's score
Player->stats.m_score += (int)(Mission_events[event].score * scoring_get_scale_factor());
}
} else {
// set the timestamp to time out 'interval' seconds in the future. We must also reset the
// value at the sexpresion node to unknown so that it will get reevaled
Mission_events[event].timestamp = timestamp( Mission_events[event].interval * 1000 );
// Sexp_nodes[Mission_events[event].formula].value = SEXP_UNKNOWN;
}
}
#ifndef NO_NETWORK
// see if anything has changed
if(MULTIPLAYER_MASTER && ((store_flags != Mission_events[event].flags) || (store_formula != Mission_events[event].formula) || (store_result != Mission_events[event].result) || (store_count != Mission_events[event].count)) ){
send_event_update_packet(event);
}
#endif
}
// Maybe play a directive success sound... need to poll since the sound is delayed from when
// the directive is actually satisfied.
void mission_maybe_play_directive_success_sound()
{
if ( timestamp_elapsed(Mission_directive_sound_timestamp) ) {
Mission_directive_sound_timestamp=0;
snd_play( &Snds[SND_DIRECTIVE_COMPLETE] );
}
}
void mission_eval_goals()
{
int i, result, goal_changed = 0;
// before checking whether or not we should evaluate goals, we should run through the events and
// process any whose timestamp is valid and has expired. This would catch repeating events only
for (i=0; i<Num_mission_events; i++) {
if (Mission_events[i].formula != -1) {
if ( !timestamp_valid(Mission_events[i].timestamp) || !timestamp_elapsed(Mission_events[i].timestamp) ){
continue;
}
// if we get here, then the timestamp on the event has popped -- we should reevaluate
mission_process_event(i);
}
}
if ( !timestamp_elapsed(Mission_goal_timestamp) ){
return;
}
// first evaluate the players goals
for (i=0; i<Num_goals; i++) {
// don't evaluate invalid goals
if (Mission_goals[i].type & INVALID_GOAL){
continue;
}
if (Mission_goals[i].satisfied == GOAL_INCOMPLETE) {
result = eval_sexp(Mission_goals[i].formula);
if ( Sexp_nodes[Mission_goals[i].formula].value == SEXP_KNOWN_FALSE ) {
goal_changed = 1;
mission_goal_status_change( i, GOAL_FAILED );
} else if (result) {
goal_changed = 1;
mission_goal_status_change(i, GOAL_COMPLETE );
} // end if result
// tell the player how to end the mission
//if ( goal_changed && mission_evaluate_primary_goals() != PRIMARY_GOALS_INCOMPLETE ) {
// HUD_sourced_printf(HUD_SOURCE_IMPORTANT, "Press %s to end mission and return to base", textify_scancode(Control_config[END_MISSION].key_id) );
//}
} // end if goals[i].satsified != GOAL_COMPLETE
} // end for
// now evaluate any mission events
for (i=0; i<Num_mission_events; i++) {
if ( Mission_events[i].formula != -1 ) {
// only evaluate this event if the timestamp is not valid. We do this since
// we will evaluate repeatable events at the top of the file so we can get
// the exact interval that the designer asked for.
if ( !timestamp_valid( Mission_events[i].timestamp) ){
mission_process_event( i );
}
}
}
if (The_mission.game_type & MISSION_TYPE_TRAINING){
Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP_TRAINING);
} else {
Mission_goal_timestamp = timestamp(GOAL_TIMESTAMP);
}
if ( !hud_disabled() && hud_gauge_active(HUD_DIRECTIVES_VIEW) ) {
mission_maybe_play_directive_success_sound();
}
#ifndef NO_NETWORK
// update goal status if playing on a multiplayer standalone server
if (Game_mode & GM_STANDALONE_SERVER){
std_multi_update_goals();
}
#endif
}
// evaluate_primary_goals() will determine if the primary goals for a mission are complete
//
// returns 1 - all primary goals are all complete or imcomplete (or there are no primary goals at all)
// returns 0 - not all primary goals are complete
int mission_evaluate_primary_goals()
{
int i, primary_goals_complete = PRIMARY_GOALS_COMPLETE;
for (i=0; i<Num_goals; i++) {
if ( Mission_goals[i].type & INVALID_GOAL ) {
continue;
}
if ( (Mission_goals[i].type & GOAL_TYPE_MASK) == PRIMARY_GOAL ) {
if ( Mission_goals[i].satisfied == GOAL_INCOMPLETE ) {
return PRIMARY_GOALS_INCOMPLETE;
} else if ( Mission_goals[i].satisfied == GOAL_FAILED ) {
primary_goals_complete = PRIMARY_GOALS_FAILED;
}
}
} // end for
return primary_goals_complete;
}
// return 1 if all primary/secondary goals are complete... otherwise return 0
int mission_goals_met()
{
int i, all_goals_met = 1;
for (i=0; i<Num_goals; i++) {
if ( Mission_goals[i].type & INVALID_GOAL ) {
continue;
}
if ( ((Mission_goals[i].type & GOAL_TYPE_MASK) == PRIMARY_GOAL) || ((Mission_goals[i].type & GOAL_TYPE_MASK) == SECONDARY_GOAL) ) {
if ( Mission_goals[i].satisfied == GOAL_INCOMPLETE ) {
all_goals_met = 0;
break;
} else if ( Mission_goals[i].satisfied == GOAL_FAILED ) {
all_goals_met = 0;
break;
}
}
} // end for
return all_goals_met;
}
// function used to actually change the status (valid/invalid) of a goal. Called externally
// with multiplayer code
void mission_goal_validation_change( int goal_num, int valid )
{
// only incomplete goals can have their status changed
if ( Mission_goals[goal_num].satisfied != GOAL_INCOMPLETE ){
return;
}
#ifndef NO_NETWORK
// if in multiplayer, then send a packet
if ( MULTIPLAYER_MASTER ){
send_mission_goal_info_packet( goal_num, -1, valid );
}
#endif
// change the valid status
if ( valid ){
Mission_goals[goal_num].type &= ~INVALID_GOAL;
} else {
Mission_goals[goal_num].type |= INVALID_GOAL;
}
}
// the following function marks a goal invalid. It can only mark the goal invalid if the goal
// is not complete. The name passed into this funciton should match the name field in the goal
// structure
void mission_goal_mark_invalid( char *name )
{
int i;
for (i=0; i<Num_goals; i++) {
if ( !stricmp(Mission_goals[i].name, name) ) {
mission_goal_validation_change( i, 0 );
return;
}
}
}
// the next function marks a goal as valid. A goal may always be marked valid.
void mission_goal_mark_valid( char *name )
{
int i;
for (i=0; i<Num_goals; i++) {
if ( !stricmp(Mission_goals[i].name, name) ) {
mission_goal_validation_change( i, 1 );
return;
}
}
}
// function to fail all mission goals. Don't fail events here since this funciton is currently
// called in mission when something bad happens to the player (like he makes too many shots on friendlies).
// Events can still happen. Things will just be really bad for the player.
void mission_goal_fail_all()
{
int i;
for (i=0; i<Num_goals; i++) {
Mission_goals[i].satisfied = GOAL_FAILED;
mission_log_add_entry( LOG_GOAL_FAILED, Mission_goals[i].name, NULL, i );
}
}
// function to mark all incomplete goals as failed. Happens at the end of a mission
// mark the events which are not currently satisfied as failed as well.
void mission_goal_fail_incomplete()
{
int i;
for (i = 0; i < Num_goals; i++ ) {
if ( Mission_goals[i].satisfied == GOAL_INCOMPLETE ) {
Mission_goals[i].satisfied = GOAL_FAILED;
mission_log_add_entry( LOG_GOAL_FAILED, Mission_goals[i].name, NULL, i );
}
}
// now for the events. Must set the formula to -1 and the result to 0 to be a failed
// event.
for ( i = 0; i < Num_mission_events; i++ ) {
if ( Mission_events[i].formula != -1 ) {
Mission_events[i].formula = -1;
Mission_events[i].result = 0;
}
}
}
// small function used to mark all objectives as true. Used as a debug function and as a way
// to skip past training misisons
void mission_goal_mark_objectives_complete()
{
int i;
for (i = 0; i < Num_goals; i++ ) {
Mission_goals[i].satisfied = GOAL_COMPLETE;
}
}
// small function used to mark all events as completed. Used in the skipping of missions.
void mission_goal_mark_events_complete()
{
int i;
for (i = 0; i < Num_mission_events; i++ ) {
Mission_events[i].result = 1;
Mission_events[i].formula = -1;
}
}
// some debug console functions to help list and change the status of mission goals
DCF(show_mission_goals,"List and change the status of mission goals")
{
int i, type;
if (Dc_command)
Dc_status = 1;
if (Dc_help) {
dc_printf("Usage: show_mission_goals\n\nList all mission goals and their current status.\n");
Dc_status = 0;
}
if (Dc_status) {
for (i=0; i<Num_goals; i++) {
type = Mission_goals[i].type & GOAL_TYPE_MASK;
dc_printf("%2d. %32s(%10s) -- ", i, Mission_goals[i].name, Goal_type_text(type));
if ( Mission_goals[i].satisfied == GOAL_COMPLETE )
dc_printf("satisfied.\n");
else if ( Mission_goals[i].satisfied == GOAL_INCOMPLETE )
dc_printf("not satisfied\n");
else if ( Mission_goals[i].satisfied == GOAL_FAILED )
dc_printf("failed\n");
else
dc_printf("\t[unknown goal status].\n");
}
}
}
//XSTR:OFF
DCF(change_mission_goal, "Change the mission goal")
{
int num;
if ( Dc_command ) {
dc_get_arg(ARG_INT);
if ( Dc_arg_int >= Num_goals ) {
dc_printf ("First parameter must be a valid goal number.\n");
return;
}
num = Dc_arg_int;
dc_get_arg(ARG_TRUE|ARG_FALSE|ARG_STRING);
if ( Dc_arg_type & ARG_TRUE )
Mission_goals[num].satisfied = GOAL_COMPLETE;
else if ( Dc_arg_type & ARG_FALSE )
Mission_goals[num].satisfied = GOAL_FAILED;
else if ( Dc_arg_type & ARG_NONE )
Mission_goals[num].satisfied = GOAL_INCOMPLETE;
else if ( Dc_arg_type & ARG_STRING) {
if ( !stricmp(Dc_arg, "satisfied") )
Mission_goals[num].satisfied = GOAL_COMPLETE;
else if ( !stricmp( Dc_arg, "failed") )
Mission_goals[num].satisfied = GOAL_FAILED;
else if ( !stricmp( Dc_arg, "unknown") )
Mission_goals[num].satisfied = GOAL_INCOMPLETE;
else
dc_printf("Unknown status %s. Use 'satisfied', 'failed', or 'unknown'\n", Dc_arg);
}
}
if ( Dc_help ) {
dc_printf("Usage: change_mission_goal <goal_num> <status>\n");
dc_printf("<goal_num> -- Integer number of goal to change. See show_mission_goals\n");
dc_printf("<status> -- [bool] where a true value makes the goal satisfied,\n");
dc_printf(" a false value makes the goal failed.\n");
dc_printf("The <status> field may also be one of 'satisfied', 'failed', or 'unknown'\n");
dc_printf("\nExamples:\n\n'change_mission_goal 1 true' makes goal 1 successful.\n");
dc_printf("'change_mission_goal 2' marks goal 2 not complete\n");
dc_printf("'change_mission_goal 0 satisfied' marks goal 0 as satisfied\n");
Dc_status = 0;
}
}
//XSTR:ON
// debug functions to mark all primary/secondary/bonus goals as true
#ifndef DEBUG
void mission_goal_mark_all_true(int type)
{
int i;
for (i = 0; i < Num_goals; i++ ) {
if ( (Mission_goals[i].type & GOAL_TYPE_MASK) == type )
Mission_goals[i].satisfied = GOAL_COMPLETE;
}
HUD_sourced_printf(HUD_SOURCE_HIDDEN, NOX("All %s goals marked true"), Goal_type_text(type) );
}
#endif
void goal_screen_button_pressed(int num)
{
switch (num) {
case GOAL_SCREEN_BUTTON_SCROLL_UP:
goal_screen_scroll_up();
break;
case GOAL_SCREEN_BUTTON_SCROLL_DOWN:
goal_screen_scroll_down();
break;
case GOAL_SCREEN_BUTTON_RETURN:
mission_goal_exit();
break;
}
}
void goal_screen_scroll_up()
{
if (Scroll_offset) {
Scroll_offset--;
gamesnd_play_iface(SND_SCROLL);
} else {
gamesnd_play_iface(SND_GENERAL_FAIL);
}
}
void goal_screen_scroll_down()
{
int max_lines;
max_lines = Goal_screen_text_h / gr_get_font_height();
if (Scroll_offset + max_lines < Goal_text.m_num_lines) {
Scroll_offset++;
gamesnd_play_iface(SND_SCROLL);
} else {
gamesnd_play_iface(SND_GENERAL_FAIL);
}
}
// Return the number of resolved goals in num_resolved, return the total
// number of valid goals in total
void mission_goal_fetch_num_resolved(int desired_type, int *num_resolved, int *total, int team)
{
int i,type;
*num_resolved=0;
*total=0;
for (i=0; i<Num_goals; i++) {
// if we're checking for team
if((team >= 0) && (Mission_goals[i].team != team)){
continue;
}
if (Mission_goals[i].type & INVALID_GOAL) {
continue;
}
type = Mission_goals[i].type & GOAL_TYPE_MASK;
if ( type != desired_type ) {
continue;
}
*total = *total + 1;
if (Mission_goals[i].satisfied != GOAL_INCOMPLETE) {
*num_resolved = *num_resolved + 1;
}
}
}
// Return whether there are any incomplete goals of the specified type
int mission_goals_incomplete(int desired_type, int team)
{
int i, type;
for (i=0; i<Num_goals; i++) {
// if we're checking for team
if((team >= 0) && (Mission_goals[i].team != team)){
continue;
}
if (Mission_goals[i].type & INVALID_GOAL) {
continue;
}
type = Mission_goals[i].type & GOAL_TYPE_MASK;
if ( type != desired_type ) {
continue;
}
if (Mission_goals[i].satisfied == GOAL_INCOMPLETE) {
return 1;
}
}
return 0;
}
void mission_goal_exit()
{
snd_play( &Snds_iface[SND_USER_SELECT] );
gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
}
| [
"Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3"
] | Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.