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
9f4ce9bc9750b29433bfb1b74e9ff57de527367f
8d6277108164d60cc323191900d2700c42ce83c5
/cpp/src/arrow/util/uri.h
3d6949537ce72de3d2bab5411f66ede7c701d1f3
[ "Apache-2.0", "CC0-1.0", "BSD-3-Clause", "MIT", "ZPL-2.1", "BSL-1.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
SeppPenner/arrow
0fa703c696a4570485d3ba34ed2c83c8ce65185f
1df8806c61ace322a72bd44e73e7060af53d4b82
refs/heads/master
2020-05-05T02:07:38.921743
2019-11-25T08:22:31
2019-11-25T08:22:31
179,625,814
1
0
Apache-2.0
2019-11-25T08:22:32
2019-04-05T05:45:41
C++
UTF-8
C++
false
false
2,273
h
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you 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 <cstdint> #include <memory> #include <string> #include "arrow/status.h" #include "arrow/util/visibility.h" namespace arrow { namespace internal { /// \brief A parsed URI class ARROW_EXPORT Uri { public: Uri(); ~Uri(); // XXX Should we use util::string_view instead? These functions are // not performance-critical. /// The URI scheme, such as "http", or the empty string if the URI has no /// explicit scheme. std::string scheme() const; /// Whether the URI has an explicit host name. This may return true if /// the URI has an empty host (e.g. "file:///tmp/foo"), while it returns /// false is the URI has not host component at all (e.g. "file:/tmp/foo"). bool has_host() const; /// The URI host name, such as "localhost", "127.0.0.1" or "::1", or the empty /// string is the URI does not have a host component. std::string host() const; /// The URI port number, as a string such as "80", or the empty string is the URI /// does not have a port number component. std::string port_text() const; /// The URI port parsed as an integer, or -1 if the URI does not have a port /// number component. int32_t port() const; /// The URI path component. std::string path() const; /// Factory function to parse a URI from its string representation. Status Parse(const std::string& uri_string); private: struct Impl; std::unique_ptr<Impl> impl_; }; } // namespace internal } // namespace arrow
[ "Uwe.Korn@blue-yonder.com" ]
Uwe.Korn@blue-yonder.com
8a8892eb8e7232ab2750ce2fdd6a84dd82fd5b06
d373abf69b76940bc4f5da771223f974ee0b46fe
/include/pointpose.h
59e75f991affe97bd503721b11a7694ae0798789
[]
no_license
capox95/clothes_manipulation
fb2ded90ff312c566581d66a68aab51ba4773937
65d81f75417321ce7f4338b81fb8c8329b176760
refs/heads/master
2020-09-28T07:37:16.081826
2019-12-08T21:14:59
2019-12-08T21:14:59
226,725,017
0
0
null
null
null
null
UTF-8
C++
false
false
2,759
h
#include <pcl/ModelCoefficients.h> #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <Eigen/StdVector> typedef std::vector<Eigen::Affine3d, Eigen::aligned_allocator<Eigen::Affine3d>> Affine3dVector; typedef std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>> Vector3fVector; struct CoordinateFramePoints { pcl::PointXYZ x; pcl::PointXYZ y; pcl::PointXYZ z; pcl::PointXYZ o; }; class PointPoseDrum { private: pcl::PointCloud<pcl::PointXYZRGB>::Ptr m_source; pcl::PointCloud<pcl::PointXYZ>::Ptr m_cloud_grasp, m_cloud_projected; std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> m_clouds_vector; std::vector<CoordinateFramePoints> m_cfp; std::vector<CoordinateFramePoints> m_cfp_viz; pcl::ModelCoefficients m_axis, m_plane; std::vector<pcl::PointXYZ> m_pointOnAxis; Eigen::Vector3f m_trans; Eigen::Quaternionf m_rot; pcl::PointXYZ m_origin; pcl::ModelCoefficients m_line; Eigen::Vector3f _directionX, _directionY, _directionZ, centroid_centroid; public: PointPoseDrum() : m_source(new pcl::PointCloud<pcl::PointXYZRGB>), m_cloud_grasp(new pcl::PointCloud<pcl::PointXYZ>), m_cloud_projected(new pcl::PointCloud<pcl::PointXYZ>) { } void setSourceCloud(pcl::PointCloud<pcl::PointXYZRGB>::Ptr &cloud_in); void setInputCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud); void setDrumAxis(pcl::ModelCoefficients &axis); void setInputVectorClouds(std::vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> &clouds); int compute(Vector3fVector &pointsOnAxis, Affine3dVector &transformation_matrix_vector); bool computeGraspPoint(pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud, Eigen::Vector3f &point, Eigen::Affine3d &transformation_matrix); void visualizeGrasp(); private: std::vector<int> orderEigenvalues(Eigen::Vector3f eigenValuesPCA); void getCoordinateFrame(Eigen::Vector3f &centroid, Eigen::Matrix3f &rotation, pcl::PointXYZ &pointOnTheLine, Eigen::Vector3f &directionX, Eigen::Vector3f &directionZ); Eigen::Affine3d computeTransformation(Eigen::Vector3f &centroid, Eigen::Vector3f &directionX, Eigen::Vector3f &directionZ); void computeRefPlane(pcl::ModelCoefficients &axis, Eigen::Vector4f &centroid, pcl::ModelCoefficients &plane, pcl::PointXYZ &pointOnTheLine); void projectPointsOntoPlane(pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud, pcl::ModelCoefficients &plane, pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud_projected); void computeCoordinateFramePointsViz(Eigen::Vector3f &centroid, Eigen::Matrix3f &rotation, bool reverse); };
[ "capox95@gmail.com" ]
capox95@gmail.com
de36a31c794dc61ee002701999e6dcd20a19ff4c
6e6f1caae569ac0a7b2cf35da9ad779a81d293e1
/Utilities/Pnt3f.cpp
ad5c69118b81f9ed5cb4dd90365b3b5a93be49e7
[]
no_license
kirakira/train
375047e33e0f1327299c54fa6a5710275de9d4dc
35fd7952f67e5727bc22f93f09d6efbdc80cc08e
refs/heads/master
2021-01-25T04:03:16.710349
2015-05-14T03:59:24
2015-05-14T03:59:24
35,589,683
0
0
null
null
null
null
UTF-8
C++
false
false
952
cpp
// CS559 Utility Code // - implementation of simple 3D point class // see the header file for details // // file put together by Mike Gleicher, October 2008 // #include "Pnt3f.H" #include "math.h" Pnt3f::Pnt3f() : x(0), y(0), z(0) { } Pnt3f::Pnt3f(const float* iv) : x(iv[0]), y(iv[1]), z(iv[2]) { } Pnt3f::Pnt3f(const float _x, const float _y, const float _z) : x(_x), y(_y), z(_z) { } void Pnt3f::normalize() { if (isZero()) { x = 0; y = 1; z = 0; } else { float l = norm(); x /= l; y /= l; z /= l; } } float Pnt3f::norm() const { return sqrt(x * x + y * y + z * z); } bool Pnt3f::isZero() const { return norm() < 1e-3; } // This code tells us where the original came from in CVS // Its a good idea to leave it as-is so we know what version of // things you started with // $Header: /p/course/cs559-gleicher/private/CVS/Utilities/Pnt3f.cpp,v 1.3 2008/10/19 01:54:28 gleicher Exp $
[ "wmhkebe@gmail.com" ]
wmhkebe@gmail.com
5fac4ae71a1bde154bd01cab08f534ed9d4db56a
bb887168567c3fc8252308bd4749dbd87a4cbfab
/Hackerrank/bfs_shortest.cpp
641bf395575a871327810bbfb514e2c153e3ac43
[]
no_license
sudoRicheek/CP
40769e37d796340cf322d5a70a8b0e82cc308a33
b4aa01e1119dfe77b84f997fe3b41a2ad0a77f78
refs/heads/master
2022-11-21T18:24:30.427274
2020-07-29T15:17:16
2020-07-29T15:17:16
281,201,551
0
0
null
null
null
null
UTF-8
C++
false
false
1,978
cpp
#include <bits/stdc++.h> using namespace std; vector<string> split_string(string); // Complete the bfs function below. vector<int> bfs(int n, int m, vector<vector<int>> edges, int s) { } int main() { ofstream fout(getenv("OUTPUT_PATH")); int q; cin >> q; cin.ignore(numeric_limits<streamsize>::max(), '\n'); for (int q_itr = 0; q_itr < q; q_itr++) { string nm_temp; getline(cin, nm_temp); vector<string> nm = split_string(nm_temp); int n = stoi(nm[0]); int m = stoi(nm[1]); vector<vector<int>> edges(m); for (int i = 0; i < m; i++) { edges[i].resize(2); for (int j = 0; j < 2; j++) { cin >> edges[i][j]; } cin.ignore(numeric_limits<streamsize>::max(), '\n'); } int s; cin >> s; cin.ignore(numeric_limits<streamsize>::max(), '\n'); vector<int> result = bfs(n, m, edges, s); for (int i = 0; i < result.size(); i++) { fout << result[i]; if (i != result.size() - 1) { fout << " "; } } fout << "\n"; } fout.close(); return 0; } vector<string> split_string(string input_string) { string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) { return x == y and x == ' '; }); input_string.erase(new_end, input_string.end()); while (input_string[input_string.length() - 1] == ' ') { input_string.pop_back(); } vector<string> splits; char delimiter = ' '; size_t i = 0; size_t pos = input_string.find(delimiter); while (pos != string::npos) { splits.push_back(input_string.substr(i, pos - i)); i = pos + 1; pos = input_string.find(delimiter, i); } splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1)); return splits; }
[ "richeekdas2001@gmail.com" ]
richeekdas2001@gmail.com
9b508e2be089501221811b09a6e26b36a952ea9a
334558bf31b6a8fd3caaf09c24898ff331c7e2da
/GenieWindow/plugins/GeniePlugin_MapV2/src/newdevicenotifywidget.cpp
654314e9f7b77f79ff781ac98e70ebcd3f5f1823
[]
no_license
roygaogit/Bigit_Genie
e38bac558e81d9966ec6efbdeef0a7e2592156a7
936a56154a5f933b1e9c049ee044d76ff1d6d4db
refs/heads/master
2020-03-31T04:20:04.177461
2013-12-09T03:38:15
2013-12-09T03:38:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,288
cpp
#include "newdevicenotifywidget.h" #include "language_Map.h" #include <QTextEdit> #include <QLabel> #include <QPushButton> #include <QEvent> #include <QPainter> #include <QMouseEvent> #include <QFile> #include <QHBoxLayout> #include <QVBoxLayout> #include <QApplication> #include <QPropertyAnimation> #include <QDesktopWidget> #include <QTimerEvent> #include "genie2_interface.h" #define NDNW_BACKGROUDIMAGE "map/others/NewDeviceNotifyWidgetBk.png" #define NEWDEVICENOTIFYWIDGET_STYLEFILE "ui/newdevicenotifywidget.qss" #define DELAYINTERVAL_MS 1000 #define DELAY_COUNTER_MAX 15 NewDeviceNotifyWidget::NewDeviceNotifyWidget(QWidget *parent) : QWidget(parent), m_canMove(false), m_notifyAnimation(0), m_timeoutCounter(DELAY_COUNTER_MAX), m_timerId(0) { setWindowFlags(Qt::FramelessWindowHint | Qt::ToolTip); setAttribute(Qt::WA_TranslucentBackground); m_closeBtn = new QPushButton(this); m_closeBtn->setFlat(true); m_okBtn = new QPushButton(this); // SET_STYLE_PROPERTY(FLEX_BUTTON,m_okBtn); m_closeBtn->setObjectName("NewDeviceNotifyWidgetCloseButton"); m_titleLabel = new QLabel(this); m_titleContentLabel = new QLabel(this); m_bodyEdit = new QTextEdit(this); m_bodyEdit->setObjectName("NewDeviceNotifyWidgetEdit"); m_titleLabel->setObjectName("NewDeviceNotifyWidgetTitle"); m_titleLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom); m_titleContentLabel->setAlignment(Qt::AlignRight | Qt::AlignBottom); m_bodyEdit->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); QPixmap pixDetecter(GENIE2_RES(NDNW_BACKGROUDIMAGE) ); setFixedSize(pixDetecter.size()); QHBoxLayout *btnLayout = new QHBoxLayout(); #ifdef Q_OS_MAC btnLayout->setContentsMargins(0,2,0,0); #endif btnLayout->addStretch(1); btnLayout->addWidget(m_closeBtn); QHBoxLayout *okbtnLayout = new QHBoxLayout(); okbtnLayout->setContentsMargins(0,0,0,0); okbtnLayout->addStretch(1); okbtnLayout->addWidget(m_okBtn); QHBoxLayout *titleLayout = new QHBoxLayout(); titleLayout->setContentsMargins(20,0,20,0); titleLayout->addWidget(m_titleLabel); titleLayout->addWidget(m_titleContentLabel); QVBoxLayout *aboveLayout = new QVBoxLayout(); #ifdef Q_OS_MAC aboveLayout->setContentsMargins(0,0,0,0); #endif aboveLayout->setSpacing(9); aboveLayout->addLayout(btnLayout); aboveLayout->addLayout(titleLayout); QVBoxLayout *belowLayout = new QVBoxLayout(); belowLayout->setContentsMargins(20,6,20,6); belowLayout->addWidget(m_bodyEdit); belowLayout->addLayout(okbtnLayout); QVBoxLayout *layOut = new QVBoxLayout(this); #ifdef Q_OS_MAC layOut->setContentsMargins(9,2,4,2); #else layOut->setContentsMargins(9,12,9,2); #endif layOut->addLayout(aboveLayout); layOut->addLayout(belowLayout); connect(m_closeBtn,SIGNAL(clicked()),this,SLOT(btnClicked())); connect(m_okBtn,SIGNAL(clicked()),this,SLOT(btnClicked())); applyStyle(); retranslateUi(); } NewDeviceNotifyWidget::~NewDeviceNotifyWidget() { if(m_timerId != 0) { killTimer(m_timerId); } } void NewDeviceNotifyWidget::timerEvent(QTimerEvent *event) { setAttribute(Qt::WA_Mapped); if(event->timerId() != m_timerId) { return; } if(--m_timeoutCounter <= 0) { killTimer(m_timerId); m_timerId = 0; emit timeout(); } else { retranslateUi(); } } void NewDeviceNotifyWidget::changeEvent(QEvent *event) { if(event->type() == QEvent::LanguageChange) { retranslateUi(); } QWidget::changeEvent(event); } void NewDeviceNotifyWidget::paintEvent(QPaintEvent *event) { Q_UNUSED(event) QPainter painter(this); painter.drawPixmap(0,0,QPixmap(GENIE2_RES(NDNW_BACKGROUDIMAGE))); } void NewDeviceNotifyWidget::retranslateUi() { QString tmpText = translateText(L_MAP_YES,QString("OK")); if(m_timeoutCounter > 0) { tmpText += "("; tmpText += QString::number(m_timeoutCounter); tmpText += ")"; } m_okBtn->setText(tmpText); m_titleLabel->setText(translateText(L_MAP_NEWDEVICE,QString("New device"))); m_bodyEdit->setText(translateText(L_MAP_NEWDEVICENOTIFY_MSG,QString("Default content too long to place here"))); } void NewDeviceNotifyWidget::applyStyle() { QFile cssFile(GENIE2_RES(NEWDEVICENOTIFYWIDGET_STYLEFILE)); if (cssFile.open(QIODevice::ReadOnly)) { setStyleSheet(QString::fromUtf8(cssFile.readAll().data())); } } QString NewDeviceNotifyWidget::translateText(int idx, const QString &defaultText) { QString text; emit translateText(idx,&text); return text.isEmpty() ? defaultText : text; } void NewDeviceNotifyWidget::mousePressEvent(QMouseEvent *event) { m_pos = event->globalPos(); m_canMove = true; } void NewDeviceNotifyWidget::mouseReleaseEvent(QMouseEvent *) { m_canMove = false; } void NewDeviceNotifyWidget::mouseMoveEvent(QMouseEvent *event) { if(m_canMove && (event->buttons() & Qt::LeftButton)) { move(pos().x() - (m_pos.x() - event->globalPos().x()), pos().y() - (m_pos.y() - event->globalPos().y())); m_pos = event->globalPos(); } } void NewDeviceNotifyWidget::btnClicked() { if(m_timerId) { killTimer(m_timerId); m_timerId = 0; } emit completed(m_timeoutCounter); } void NewDeviceNotifyWidget::notifyNewDevice(const QString &title,int defaultCount) { m_titleContentLabel->setText(title); setVisible(true); QRect rect = QApplication::desktop()->screenGeometry(-1); int x = rect.width() - width() - 10; if(!m_notifyAnimation) { m_notifyAnimation = new QPropertyAnimation(this, "geometry",this); } m_notifyAnimation->setDuration(1000); m_notifyAnimation->setStartValue(QRect(x, rect.height(), width(), height())); m_notifyAnimation->setEndValue(QRect(x, rect.height() - height() - 40, width(), height())); m_notifyAnimation->start(); //timer if(m_timerId != 0) { killTimer(m_timerId); m_timerId = 0; m_timeoutCounter = (defaultCount <= 0 ? DELAY_COUNTER_MAX : defaultCount); } m_timerId = startTimer(DELAYINTERVAL_MS); }
[ "raylq@qq.com" ]
raylq@qq.com
6e9f4691c1a8cdfab3bdbd66883b3e12145373a4
fb518874988e4726805973664ddaa35e5eadc214
/cw2/population.h
645cc5b750e94582dd6c2de8372bd080afdf3ca6
[]
no_license
davidsansome/evolving-tetris
fc8f74b7f327c673afd0861991104bf0a4328503
1c3e55adae5d8f7d477016079eba0eb2bbeecf2a
refs/heads/master
2020-04-06T04:55:38.015114
2010-01-11T23:51:16
2010-01-11T23:51:16
4,369,127
3
1
null
null
null
null
UTF-8
C++
false
false
751
h
#ifndef POPULATION_H #define POPULATION_H #include "individual.h" #include <QList> class Population { public: Population(int size); void InitRandom(); Individual& operator[](int i) { return individuals_[i]; } Individual& SelectFitnessProportionate(const Individual& excluding = Individual()); Individual& Fittest(); Individual& LeastFit(); quint64 MeanFitness() const; void Replace(int i, const Individual& replacement); private: QList<Individual> individuals_; struct CompareFitness { bool operator()(const Individual& left, const Individual& right) const { Q_ASSERT(left.HasFitness()); Q_ASSERT(right.HasFitness()); return left.Fitness() < right.Fitness(); } }; }; #endif // POPULATION_H
[ "me@davidsansome.com" ]
me@davidsansome.com
4c8fe97adb5891dcc628f3552ba62f08bbd60f05
c8293cb87fe50102ee9ed04f8d5754936c6b5da6
/tcp/main.cpp
4e95a10875618b74160cd8b16e5c4df77326ec13
[]
no_license
VahidHeidari/NTA
d390bbdeb0e1bfbcb40b7ad36ec459c36e08932c
1b1251c3e784d718c821c1cd64253745da310633
refs/heads/master
2021-01-17T09:08:42.869272
2017-01-09T10:04:27
2017-01-09T10:04:27
39,677,590
7
0
null
null
null
null
UTF-8
C++
false
false
1,625
cpp
/** * NTA (Network Traffic Analyser) is contains simple tools for analysing * netwrok traffic. * * Copyright (C) 2015 Vahid Heidari (DeltaCode) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <iostream> #include <iomanip> #include <cstring> #include "Packet.h" #include "Dumper.h" #include "SendData.h" using namespace std; using namespace Dumper; int main(int argc, char** argv) { cout << endl; cout << "---------------------------------" << endl; cout << " This is TCP packet generator." << endl; cout << "---------------------------------" << endl << endl; if (!init_dumper("./TCP-GEN.pcap")) { cout << "Could not initialize dumper!" << endl; return 1; } if (argc <= 1) send(); else if (argv[1][0] == 'm') // Max MTU packet packet_1600(); else if (argv[1][0] == 'o') // Out of order send_out_of_order(); else if (argv[1][0] == 'l') // Lost packets send_out_of_order_lost(); else if (argv[1][0] == 't') // Test packets send_test(); close_dumper(); return 0; }
[ "crystal.delta@gmail.com" ]
crystal.delta@gmail.com
edec0e0df23a4ab05f94257ad0ebd2ff09f392a1
9fd3a9ce789f64dd3bde7d42703ddf109c713614
/04-Collision/LoadObject.h
32f6056735a25d0d8ad6934bb32fd6aa09a2af09
[]
no_license
DungNgoc/GameDev
5da93dfcb9e595c630c85d32b0bfb3eb6ec96952
eba2bd4b6ff2796a126a8158c49f4768cf6902bd
refs/heads/master
2022-01-06T09:27:42.805835
2019-06-03T16:09:15
2019-06-03T16:09:15
177,239,983
0
0
null
null
null
null
UTF-8
C++
false
false
351
h
#pragma once #include <string> #include <iostream> #include <fstream> #include "GameObject.h" #include "Brick.h" class LoadObject { public: void Load(string file, vector<LPGAMEOBJECT> *listObject); void LoadObjects(int id, int type, float x, float y, int width, int height, vector<LPGAMEOBJECT>* listObject); LoadObject(); ~LoadObject(); };
[ "you@example.com" ]
you@example.com
e27398f216d20fbadabd7606398c7881e077f9bb
910c7fcae933361911c0e41d51c863390eb61532
/Tablature/JuceLibraryCode/modules/juce_gui_basics/windows/juce_ComponentPeer.h
eddca8fc209f04d877757687e212d58cf31b13df
[]
no_license
bpinder/BBSTablature
791d0de108748b6e1272fb66ec92ddc90c8bcf97
28b20cb7accaebf3571c1438f3614cf852f0c0c1
refs/heads/master
2020-06-05T05:55:36.064547
2013-05-10T14:45:27
2013-05-10T14:45:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
17,516
h
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE 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. See the GNU General Public License for more details. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ #ifndef __JUCE_COMPONENTPEER_JUCEHEADER__ #define __JUCE_COMPONENTPEER_JUCEHEADER__ #include "../components/juce_Component.h" #include "../mouse/juce_MouseCursor.h" #include "../keyboard/juce_TextInputTarget.h" class ComponentBoundsConstrainer; //============================================================================== /** The Component class uses a ComponentPeer internally to create and manage a real operating-system window. This is an abstract base class - the platform specific code contains implementations of it for the various platforms. User-code should very rarely need to have any involvement with this class. @see Component::createNewPeer */ class JUCE_API ComponentPeer { public: //============================================================================== /** A combination of these flags is passed to the ComponentPeer constructor. */ enum StyleFlags { windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding entry on the taskbar (ignored on MacOSX) */ windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu, tooltip, etc. */ windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass through it (may not be possible on some platforms). */ windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific title bar and frame. if not specified, the window will be borderless. */ windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */ windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a minimise button on it. */ windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a maximise button on it. */ windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a close button on it. */ windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may not be possible on all platforms). */ windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to do its own repainting, but only to repaint when the performAnyPendingRepaintsNow() method is called. */ windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can be used for things like plugin windows, to stop them interfering with the host's shortcut keys */ windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */ }; //============================================================================== /** Creates a peer. The component is the one that we intend to represent, and the style flags are a combination of the values in the StyleFlags enum */ ComponentPeer (Component& component, int styleFlags); /** Destructor. */ virtual ~ComponentPeer(); //============================================================================== /** Returns the component being represented by this peer. */ Component& getComponent() noexcept { return component; } /** Returns the set of style flags that were set when the window was created. @see Component::addToDesktop */ int getStyleFlags() const noexcept { return styleFlags; } /** Returns a unique ID for this peer. Each peer that is created is given a different ID. */ uint32 getUniqueID() const noexcept { return uniqueID; } //============================================================================== /** Returns the raw handle to whatever kind of window is being used. On windows, this is probably a HWND, on the mac, it's likely to be a WindowRef, but rememeber there's no guarantees what you'll get back. */ virtual void* getNativeHandle() const = 0; /** Shows or hides the window. */ virtual void setVisible (bool shouldBeVisible) = 0; /** Changes the title of the window. */ virtual void setTitle (const String& title) = 0; /** If this type of window is capable of indicating that the document in it has been edited, then this changes its status. For example in OSX, this changes the appearance of the close button. @returns true if the window has a mechanism for showing this, or false if not. */ virtual bool setDocumentEditedStatus (bool edited); //============================================================================== /** Moves the window without changing its size. If the native window is contained in another window, then the co-ordinates are relative to the parent window's origin, not the screen origin. This should result in a callback to handleMovedOrResized(). */ virtual void setPosition (int x, int y) = 0; /** Resizes the window without changing its position. This should result in a callback to handleMovedOrResized(). */ virtual void setSize (int w, int h) = 0; /** Moves and resizes the window. If the native window is contained in another window, then the co-ordinates are relative to the parent window's origin, not the screen origin. This should result in a callback to handleMovedOrResized(). */ virtual void setBounds (int x, int y, int w, int h, bool isNowFullScreen) = 0; /** Returns the current position and size of the window. If the native window is contained in another window, then the co-ordinates are relative to the parent window's origin, not the screen origin. */ virtual Rectangle<int> getBounds() const = 0; /** Returns the x-position of this window, relative to the screen's origin. */ virtual Point<int> getScreenPosition() const = 0; /** Converts a position relative to the top-left of this component to screen co-ordinates. */ virtual Point<int> localToGlobal (const Point<int>& relativePosition) = 0; /** Converts a rectangle relative to the top-left of this component to screen co-ordinates. */ virtual Rectangle<int> localToGlobal (const Rectangle<int>& relativePosition); /** Converts a screen co-ordinate to a position relative to the top-left of this component. */ virtual Point<int> globalToLocal (const Point<int>& screenPosition) = 0; /** Converts a screen area to a position relative to the top-left of this component. */ virtual Rectangle<int> globalToLocal (const Rectangle<int>& screenPosition); /** Minimises the window. */ virtual void setMinimised (bool shouldBeMinimised) = 0; /** True if the window is currently minimised. */ virtual bool isMinimised() const = 0; /** Enable/disable fullscreen mode for the window. */ virtual void setFullScreen (bool shouldBeFullScreen) = 0; /** True if the window is currently full-screen. */ virtual bool isFullScreen() const = 0; /** Sets the size to restore to if fullscreen mode is turned off. */ void setNonFullScreenBounds (const Rectangle<int>& newBounds) noexcept; /** Returns the size to restore to if fullscreen mode is turned off. */ const Rectangle<int>& getNonFullScreenBounds() const noexcept; /** Attempts to change the icon associated with this window. */ virtual void setIcon (const Image& newIcon) = 0; /** Sets a constrainer to use if the peer can resize itself. The constrainer won't be deleted by this object, so the caller must manage its lifetime. */ void setConstrainer (ComponentBoundsConstrainer* newConstrainer) noexcept; /** Returns the current constrainer, if one has been set. */ ComponentBoundsConstrainer* getConstrainer() const noexcept { return constrainer; } /** Checks if a point is in the window. Coordinates are relative to the top-left of this window. If trueIfInAChildWindow is false, then this returns false if the point is actually inside a child of this window. */ virtual bool contains (const Point<int>& position, bool trueIfInAChildWindow) const = 0; /** Returns the size of the window frame that's around this window. Whether or not the window has a normal window frame depends on the flags that were set when the window was created by Component::addToDesktop() */ virtual BorderSize<int> getFrameSize() const = 0; /** This is called when the window's bounds change. A peer implementation must call this when the window is moved and resized, so that this method can pass the message on to the component. */ void handleMovedOrResized(); /** This is called if the screen resolution changes. A peer implementation must call this if the monitor arrangement changes or the available screen size changes. */ virtual void handleScreenSizeChange(); //============================================================================== /** This is called to repaint the component into the given context. */ void handlePaint (LowLevelGraphicsContext& contextToPaintTo); //============================================================================== /** Sets this window to either be always-on-top or normal. Some kinds of window might not be able to do this, so should return false. */ virtual bool setAlwaysOnTop (bool alwaysOnTop) = 0; /** Brings the window to the top, optionally also giving it focus. */ virtual void toFront (bool makeActive) = 0; /** Moves the window to be just behind another one. */ virtual void toBehind (ComponentPeer* other) = 0; /** Called when the window is brought to the front, either by the OS or by a call to toFront(). */ void handleBroughtToFront(); //============================================================================== /** True if the window has the keyboard focus. */ virtual bool isFocused() const = 0; /** Tries to give the window keyboard focus. */ virtual void grabFocus() = 0; /** Called when the window gains keyboard focus. */ void handleFocusGain(); /** Called when the window loses keyboard focus. */ void handleFocusLoss(); Component* getLastFocusedSubcomponent() const noexcept; /** Called when a key is pressed. For keycode info, see the KeyPress class. Returns true if the keystroke was used. */ bool handleKeyPress (int keyCode, juce_wchar textCharacter); /** Called whenever a key is pressed or released. Returns true if the keystroke was used. */ bool handleKeyUpOrDown (bool isKeyDown); /** Called whenever a modifier key is pressed or released. */ void handleModifierKeysChange(); //============================================================================== /** Tells the window that text input may be required at the given position. This may cause things like a virtual on-screen keyboard to appear, depending on the OS. */ virtual void textInputRequired (const Point<int>& position) = 0; /** If there's some kind of OS input-method in progress, this should dismiss it. */ virtual void dismissPendingTextInput(); /** Returns the currently focused TextInputTarget, or null if none is found. */ TextInputTarget* findCurrentTextInputTarget(); //============================================================================== /** Invalidates a region of the window to be repainted asynchronously. */ virtual void repaint (const Rectangle<int>& area) = 0; /** This can be called (from the message thread) to cause the immediate redrawing of any areas of this window that need repainting. You shouldn't ever really need to use this, it's mainly for special purposes like supporting audio plugins where the host's event loop is out of our control. */ virtual void performAnyPendingRepaintsNow() = 0; /** Changes the window's transparency. */ virtual void setAlpha (float newAlpha) = 0; //============================================================================== void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time); void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, const MouseWheelDetails&); void handleUserClosingWindow(); struct DragInfo { StringArray files; String text; Point<int> position; bool isEmpty() const noexcept { return files.size() == 0 && text.isEmpty(); } void clear() noexcept { files.clear(); text = String::empty; } }; bool handleDragMove (const DragInfo&); bool handleDragExit (const DragInfo&); bool handleDragDrop (const DragInfo&); //============================================================================== /** Resets the masking region. The subclass should call this every time it's about to call the handlePaint method. @see addMaskedRegion */ void clearMaskedRegion(); /** Adds a rectangle to the set of areas not to paint over. A component can call this on its peer during its paint() method, to signal that the painting code should ignore a given region. The reason for this is to stop embedded windows (such as OpenGL) getting painted over. The masked region is cleared each time before a paint happens, so a component will have to make sure it calls this every time it's painted. */ void addMaskedRegion (const Rectangle<int>& area); //============================================================================== /** Returns the number of currently-active peers. @see getPeer */ static int getNumPeers() noexcept; /** Returns one of the currently-active peers. @see getNumPeers */ static ComponentPeer* getPeer (int index) noexcept; /** Returns the peer that's attached to the given component, or nullptr if there isn't one. */ static ComponentPeer* getPeerFor (const Component*) noexcept; /** Checks if this peer object is valid. @see getNumPeers */ static bool isValidPeer (const ComponentPeer* peer) noexcept; //============================================================================== virtual StringArray getAvailableRenderingEngines(); virtual int getCurrentRenderingEngine() const; virtual void setCurrentRenderingEngine (int index); protected: //============================================================================== Component& component; const int styleFlags; RectangleList maskedRegion; Rectangle<int> lastNonFullscreenBounds; ComponentBoundsConstrainer* constrainer; static void updateCurrentModifiers() noexcept; private: //============================================================================== WeakReference<Component> lastFocusedComponent, dragAndDropTargetComponent; Component* lastDragAndDropCompUnderMouse; const uint32 uniqueID; bool fakeMouseMessageSent, isWindowMinimised; Component* getTargetForKeyPress(); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentPeer) }; #endif // __JUCE_COMPONENTPEER_JUCEHEADER__
[ "brittany.pinder@noteloop.com" ]
brittany.pinder@noteloop.com
386ff2adcd4d1123acefbc65ae952c8a3c01d4a9
d84967ba1e6adc72e120f84524c51ad57912df5a
/devel/electron20/files/patch-base_system_sys__info.h
de62a9292509e6fd9e06e1623e58154ba9adcc8a
[ "BSD-3-Clause" ]
permissive
tagattie/FreeBSD-Electron
f191d03c067d03ad3007e7748de905da06ba67f9
af26f766e772bb04db5eb95148ee071101301e4e
refs/heads/master
2023-09-04T10:56:17.446818
2023-09-04T09:03:11
2023-09-04T09:03:11
176,520,396
73
9
null
2023-08-31T03:29:16
2019-03-19T13:41:20
C++
UTF-8
C++
false
false
766
h
--- base/system/sys_info.h.orig 2022-08-01 19:04:19 UTC +++ base/system/sys_info.h @@ -211,6 +211,8 @@ class BASE_EXPORT SysInfo { // On Desktop this returns true when memory <= 2GB. static bool IsLowEndDevice(); + static uint64_t MaxSharedMemorySize(); + private: FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory); FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo); @@ -221,7 +223,7 @@ class BASE_EXPORT SysInfo { static HardwareInfo GetHardwareInfoSync(); #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \ - BUILDFLAG(IS_AIX) + BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD) static int64_t AmountOfAvailablePhysicalMemory( const SystemMemoryInfoKB& meminfo); #endif
[ "tagattie@gmail.com" ]
tagattie@gmail.com
ccabbe90cf6d022a163285d62f8696f61eff549b
20f46879a2e0a354aad80db7aee0259f24f9602a
/src/utils/TableGen/AsmWriterEmitter.cpp
681012974ce8083b003f4ec9277c119e6effea90
[ "NCSA" ]
permissive
apple-oss-distributions/clang
e0b7a6ef6d2ee6fdd4ab71e5dc0a4280cb90a6f3
8204159ac8569f29fddc48862412243c2b79ce8c
refs/heads/main
2023-08-14T22:37:07.330019
2016-12-09T19:27:15
2021-10-06T05:11:14
413,590,209
7
2
null
null
null
null
UTF-8
C++
false
false
39,182
cpp
//===- AsmWriterEmitter.cpp - Generate an assembly writer -----------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This tablegen backend is emits an assembly printer for the current target. // Note that this is currently fairly skeletal, but will grow over time. // //===----------------------------------------------------------------------===// #include "AsmWriterInst.h" #include "CodeGenTarget.h" #include "SequenceToOffsetTable.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" #include "llvm/Support/MathExtras.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenBackend.h" #include <algorithm> #include <cassert> #include <map> #include <vector> using namespace llvm; #define DEBUG_TYPE "asm-writer-emitter" namespace { class AsmWriterEmitter { RecordKeeper &Records; CodeGenTarget Target; ArrayRef<const CodeGenInstruction *> NumberedInstructions; std::vector<AsmWriterInst> Instructions; std::vector<std::string> PrintMethods; public: AsmWriterEmitter(RecordKeeper &R); void run(raw_ostream &o); private: void EmitPrintInstruction(raw_ostream &o); void EmitGetRegisterName(raw_ostream &o); void EmitPrintAliasInstruction(raw_ostream &O); void FindUniqueOperandCommands(std::vector<std::string> &UOC, std::vector<unsigned> &InstIdxs, std::vector<unsigned> &InstOpsUsed, bool PassSubtarget) const; }; } // end anonymous namespace static void PrintCases(std::vector<std::pair<std::string, AsmWriterOperand> > &OpsToPrint, raw_ostream &O, bool PassSubtarget) { O << " case " << OpsToPrint.back().first << ":"; AsmWriterOperand TheOp = OpsToPrint.back().second; OpsToPrint.pop_back(); // Check to see if any other operands are identical in this list, and if so, // emit a case label for them. for (unsigned i = OpsToPrint.size(); i != 0; --i) if (OpsToPrint[i-1].second == TheOp) { O << "\n case " << OpsToPrint[i-1].first << ":"; OpsToPrint.erase(OpsToPrint.begin()+i-1); } // Finally, emit the code. O << "\n " << TheOp.getCode(PassSubtarget); O << "\n break;\n"; } /// EmitInstructions - Emit the last instruction in the vector and any other /// instructions that are suitably similar to it. static void EmitInstructions(std::vector<AsmWriterInst> &Insts, raw_ostream &O, bool PassSubtarget) { AsmWriterInst FirstInst = Insts.back(); Insts.pop_back(); std::vector<AsmWriterInst> SimilarInsts; unsigned DifferingOperand = ~0; for (unsigned i = Insts.size(); i != 0; --i) { unsigned DiffOp = Insts[i-1].MatchesAllButOneOp(FirstInst); if (DiffOp != ~1U) { if (DifferingOperand == ~0U) // First match! DifferingOperand = DiffOp; // If this differs in the same operand as the rest of the instructions in // this class, move it to the SimilarInsts list. if (DifferingOperand == DiffOp || DiffOp == ~0U) { SimilarInsts.push_back(Insts[i-1]); Insts.erase(Insts.begin()+i-1); } } } O << " case " << FirstInst.CGI->Namespace << "::" << FirstInst.CGI->TheDef->getName() << ":\n"; for (const AsmWriterInst &AWI : SimilarInsts) O << " case " << AWI.CGI->Namespace << "::" << AWI.CGI->TheDef->getName() << ":\n"; for (unsigned i = 0, e = FirstInst.Operands.size(); i != e; ++i) { if (i != DifferingOperand) { // If the operand is the same for all instructions, just print it. O << " " << FirstInst.Operands[i].getCode(PassSubtarget); } else { // If this is the operand that varies between all of the instructions, // emit a switch for just this operand now. O << " switch (MI->getOpcode()) {\n"; O << " default: llvm_unreachable(\"Unexpected opcode.\");\n"; std::vector<std::pair<std::string, AsmWriterOperand> > OpsToPrint; OpsToPrint.push_back(std::make_pair(FirstInst.CGI->Namespace + "::" + FirstInst.CGI->TheDef->getName(), FirstInst.Operands[i])); for (const AsmWriterInst &AWI : SimilarInsts) { OpsToPrint.push_back(std::make_pair(AWI.CGI->Namespace+"::"+ AWI.CGI->TheDef->getName(), AWI.Operands[i])); } std::reverse(OpsToPrint.begin(), OpsToPrint.end()); while (!OpsToPrint.empty()) PrintCases(OpsToPrint, O, PassSubtarget); O << " }"; } O << "\n"; } O << " break;\n"; } void AsmWriterEmitter:: FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands, std::vector<unsigned> &InstIdxs, std::vector<unsigned> &InstOpsUsed, bool PassSubtarget) const { InstIdxs.assign(Instructions.size(), ~0U); // This vector parallels UniqueOperandCommands, keeping track of which // instructions each case are used for. It is a comma separated string of // enums. std::vector<std::string> InstrsForCase; InstrsForCase.resize(UniqueOperandCommands.size()); InstOpsUsed.assign(UniqueOperandCommands.size(), 0); for (size_t i = 0, e = Instructions.size(); i != e; ++i) { const AsmWriterInst &Inst = Instructions[i]; if (Inst.Operands.empty()) continue; // Instruction already done. std::string Command = " "+Inst.Operands[0].getCode(PassSubtarget)+"\n"; // Check to see if we already have 'Command' in UniqueOperandCommands. // If not, add it. auto I = std::find(UniqueOperandCommands.begin(), UniqueOperandCommands.end(), Command); if (I != UniqueOperandCommands.end()) { size_t idx = I - UniqueOperandCommands.begin(); InstIdxs[i] = idx; InstrsForCase[idx] += ", "; InstrsForCase[idx] += Inst.CGI->TheDef->getName(); } else { InstIdxs[i] = UniqueOperandCommands.size(); UniqueOperandCommands.push_back(std::move(Command)); InstrsForCase.push_back(Inst.CGI->TheDef->getName()); // This command matches one operand so far. InstOpsUsed.push_back(1); } } // For each entry of UniqueOperandCommands, there is a set of instructions // that uses it. If the next command of all instructions in the set are // identical, fold it into the command. for (unsigned CommandIdx = 0, e = UniqueOperandCommands.size(); CommandIdx != e; ++CommandIdx) { for (unsigned Op = 1; ; ++Op) { // Scan for the first instruction in the set. auto NIT = std::find(InstIdxs.begin(), InstIdxs.end(), CommandIdx); if (NIT == InstIdxs.end()) break; // No commonality. // If this instruction has no more operands, we isn't anything to merge // into this command. const AsmWriterInst &FirstInst = Instructions[NIT-InstIdxs.begin()]; if (FirstInst.Operands.size() == Op) break; // Otherwise, scan to see if all of the other instructions in this command // set share the operand. bool AllSame = true; for (NIT = std::find(NIT+1, InstIdxs.end(), CommandIdx); NIT != InstIdxs.end(); NIT = std::find(NIT+1, InstIdxs.end(), CommandIdx)) { // Okay, found another instruction in this command set. If the operand // matches, we're ok, otherwise bail out. const AsmWriterInst &OtherInst = Instructions[NIT-InstIdxs.begin()]; if (OtherInst.Operands.size() == Op || OtherInst.Operands[Op] != FirstInst.Operands[Op]) { AllSame = false; break; } } if (!AllSame) break; // Okay, everything in this command set has the same next operand. Add it // to UniqueOperandCommands and remember that it was consumed. std::string Command = " " + FirstInst.Operands[Op].getCode(PassSubtarget) + "\n"; UniqueOperandCommands[CommandIdx] += Command; InstOpsUsed[CommandIdx]++; } } // Prepend some of the instructions each case is used for onto the case val. for (unsigned i = 0, e = InstrsForCase.size(); i != e; ++i) { std::string Instrs = InstrsForCase[i]; if (Instrs.size() > 70) { Instrs.erase(Instrs.begin()+70, Instrs.end()); Instrs += "..."; } if (!Instrs.empty()) UniqueOperandCommands[i] = " // " + Instrs + "\n" + UniqueOperandCommands[i]; } } static void UnescapeString(std::string &Str) { for (unsigned i = 0; i != Str.size(); ++i) { if (Str[i] == '\\' && i != Str.size()-1) { switch (Str[i+1]) { default: continue; // Don't execute the code after the switch. case 'a': Str[i] = '\a'; break; case 'b': Str[i] = '\b'; break; case 'e': Str[i] = 27; break; case 'f': Str[i] = '\f'; break; case 'n': Str[i] = '\n'; break; case 'r': Str[i] = '\r'; break; case 't': Str[i] = '\t'; break; case 'v': Str[i] = '\v'; break; case '"': Str[i] = '\"'; break; case '\'': Str[i] = '\''; break; case '\\': Str[i] = '\\'; break; } // Nuke the second character. Str.erase(Str.begin()+i+1); } } } /// EmitPrintInstruction - Generate the code for the "printInstruction" method /// implementation. Destroys all instances of AsmWriterInst information, by /// clearing the Instructions vector. void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) { Record *AsmWriter = Target.getAsmWriter(); std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName"); bool PassSubtarget = AsmWriter->getValueAsInt("PassSubtarget"); O << "/// printInstruction - This method is automatically generated by tablegen\n" "/// from the instruction set description.\n" "void " << Target.getName() << ClassName << "::printInstruction(const MCInst *MI, " << (PassSubtarget ? "const MCSubtargetInfo &STI, " : "") << "raw_ostream &O) {\n"; // Build an aggregate string, and build a table of offsets into it. SequenceToOffsetTable<std::string> StringTable; /// OpcodeInfo - This encodes the index of the string to use for the first /// chunk of the output as well as indices used for operand printing. std::vector<uint64_t> OpcodeInfo(NumberedInstructions.size()); const unsigned OpcodeInfoBits = 64; // Add all strings to the string table upfront so it can generate an optimized // representation. for (AsmWriterInst &AWI : Instructions) { if (AWI.Operands[0].OperandType == AsmWriterOperand::isLiteralTextOperand && !AWI.Operands[0].Str.empty()) { std::string Str = AWI.Operands[0].Str; UnescapeString(Str); StringTable.add(Str); } } StringTable.layout(); unsigned MaxStringIdx = 0; for (AsmWriterInst &AWI : Instructions) { unsigned Idx; if (AWI.Operands[0].OperandType != AsmWriterOperand::isLiteralTextOperand || AWI.Operands[0].Str.empty()) { // Something handled by the asmwriter printer, but with no leading string. Idx = StringTable.get(""); } else { std::string Str = AWI.Operands[0].Str; UnescapeString(Str); Idx = StringTable.get(Str); MaxStringIdx = std::max(MaxStringIdx, Idx); // Nuke the string from the operand list. It is now handled! AWI.Operands.erase(AWI.Operands.begin()); } // Bias offset by one since we want 0 as a sentinel. OpcodeInfo[AWI.CGIIndex] = Idx+1; } // Figure out how many bits we used for the string index. unsigned AsmStrBits = Log2_32_Ceil(MaxStringIdx+2); // To reduce code size, we compactify common instructions into a few bits // in the opcode-indexed table. unsigned BitsLeft = OpcodeInfoBits-AsmStrBits; std::vector<std::vector<std::string>> TableDrivenOperandPrinters; while (1) { std::vector<std::string> UniqueOperandCommands; std::vector<unsigned> InstIdxs; std::vector<unsigned> NumInstOpsHandled; FindUniqueOperandCommands(UniqueOperandCommands, InstIdxs, NumInstOpsHandled, PassSubtarget); // If we ran out of operands to print, we're done. if (UniqueOperandCommands.empty()) break; // Compute the number of bits we need to represent these cases, this is // ceil(log2(numentries)). unsigned NumBits = Log2_32_Ceil(UniqueOperandCommands.size()); // If we don't have enough bits for this operand, don't include it. if (NumBits > BitsLeft) { DEBUG(errs() << "Not enough bits to densely encode " << NumBits << " more bits\n"); break; } // Otherwise, we can include this in the initial lookup table. Add it in. for (size_t i = 0, e = Instructions.size(); i != e; ++i) if (InstIdxs[i] != ~0U) OpcodeInfo[Instructions[i].CGIIndex] |= (uint64_t)InstIdxs[i] << (OpcodeInfoBits-BitsLeft); BitsLeft -= NumBits; // Remove the info about this operand. for (size_t i = 0, e = Instructions.size(); i != e; ++i) { AsmWriterInst &Inst = Instructions[i]; if (!Inst.Operands.empty()) { unsigned NumOps = NumInstOpsHandled[InstIdxs[i]]; assert(NumOps <= Inst.Operands.size() && "Can't remove this many ops!"); Inst.Operands.erase(Inst.Operands.begin(), Inst.Operands.begin()+NumOps); } } // Remember the handlers for this set of operands. TableDrivenOperandPrinters.push_back(std::move(UniqueOperandCommands)); } // Emit the string table itself. O << " static const char AsmStrs[] = {\n"; StringTable.emit(O, printChar); O << " };\n\n"; // Emit the lookup tables in pieces to minimize wasted bytes. unsigned BytesNeeded = ((OpcodeInfoBits - BitsLeft) + 7) / 8; unsigned Table = 0, Shift = 0; SmallString<128> BitsString; raw_svector_ostream BitsOS(BitsString); // If the total bits is more than 32-bits we need to use a 64-bit type. BitsOS << " uint" << ((BitsLeft < (OpcodeInfoBits - 32)) ? 64 : 32) << "_t Bits = 0;\n"; while (BytesNeeded != 0) { // Figure out how big this table section needs to be, but no bigger than 4. unsigned TableSize = std::min(1 << Log2_32(BytesNeeded), 4); BytesNeeded -= TableSize; TableSize *= 8; // Convert to bits; uint64_t Mask = (1ULL << TableSize) - 1; O << " static const uint" << TableSize << "_t OpInfo" << Table << "[] = {\n"; for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { O << " " << ((OpcodeInfo[i] >> Shift) & Mask) << "U,\t// " << NumberedInstructions[i]->TheDef->getName() << "\n"; } O << " };\n\n"; // Emit string to combine the individual table lookups. BitsOS << " Bits |= "; // If the total bits is more than 32-bits we need to use a 64-bit type. if (BitsLeft < (OpcodeInfoBits - 32)) BitsOS << "(uint64_t)"; BitsOS << "OpInfo" << Table << "[MI->getOpcode()] << " << Shift << ";\n"; // Prepare the shift for the next iteration and increment the table count. Shift += TableSize; ++Table; } // Emit the initial tab character. O << " O << \"\\t\";\n\n"; O << " // Emit the opcode for the instruction.\n"; O << BitsString; // Emit the starting string. O << " assert(Bits != 0 && \"Cannot print this instruction.\");\n" << " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ")-1;\n\n"; // Output the table driven operand information. BitsLeft = OpcodeInfoBits-AsmStrBits; for (unsigned i = 0, e = TableDrivenOperandPrinters.size(); i != e; ++i) { std::vector<std::string> &Commands = TableDrivenOperandPrinters[i]; // Compute the number of bits we need to represent these cases, this is // ceil(log2(numentries)). unsigned NumBits = Log2_32_Ceil(Commands.size()); assert(NumBits <= BitsLeft && "consistency error"); // Emit code to extract this field from Bits. O << "\n // Fragment " << i << " encoded into " << NumBits << " bits for " << Commands.size() << " unique commands.\n"; if (Commands.size() == 2) { // Emit two possibilitys with if/else. O << " if ((Bits >> " << (OpcodeInfoBits-BitsLeft) << ") & " << ((1 << NumBits)-1) << ") {\n" << Commands[1] << " } else {\n" << Commands[0] << " }\n\n"; } else if (Commands.size() == 1) { // Emit a single possibility. O << Commands[0] << "\n\n"; } else { O << " switch ((Bits >> " << (OpcodeInfoBits-BitsLeft) << ") & " << ((1 << NumBits)-1) << ") {\n" << " default: llvm_unreachable(\"Invalid command number.\");\n"; // Print out all the cases. for (unsigned j = 0, e = Commands.size(); j != e; ++j) { O << " case " << j << ":\n"; O << Commands[j]; O << " break;\n"; } O << " }\n\n"; } BitsLeft -= NumBits; } // Okay, delete instructions with no operand info left. auto I = std::remove_if(Instructions.begin(), Instructions.end(), [](AsmWriterInst &Inst) { return Inst.Operands.empty(); }); Instructions.erase(I, Instructions.end()); // Because this is a vector, we want to emit from the end. Reverse all of the // elements in the vector. std::reverse(Instructions.begin(), Instructions.end()); // Now that we've emitted all of the operand info that fit into 64 bits, emit // information for those instructions that are left. This is a less dense // encoding, but we expect the main 64-bit table to handle the majority of // instructions. if (!Instructions.empty()) { // Find the opcode # of inline asm. O << " switch (MI->getOpcode()) {\n"; O << " default: llvm_unreachable(\"Unexpected opcode.\");\n"; while (!Instructions.empty()) EmitInstructions(Instructions, O, PassSubtarget); O << " }\n"; } O << "}\n"; } static const char *getMinimalTypeForRange(uint64_t Range) { assert(Range < 0xFFFFFFFFULL && "Enum too large"); if (Range > 0xFFFF) return "uint32_t"; if (Range > 0xFF) return "uint16_t"; return "uint8_t"; } static void emitRegisterNameString(raw_ostream &O, StringRef AltName, const std::deque<CodeGenRegister> &Registers) { SequenceToOffsetTable<std::string> StringTable; SmallVector<std::string, 4> AsmNames(Registers.size()); unsigned i = 0; for (const auto &Reg : Registers) { std::string &AsmName = AsmNames[i++]; // "NoRegAltName" is special. We don't need to do a lookup for that, // as it's just a reference to the default register name. if (AltName == "" || AltName == "NoRegAltName") { AsmName = Reg.TheDef->getValueAsString("AsmName"); if (AsmName.empty()) AsmName = Reg.getName(); } else { // Make sure the register has an alternate name for this index. std::vector<Record*> AltNameList = Reg.TheDef->getValueAsListOfDefs("RegAltNameIndices"); unsigned Idx = 0, e; for (e = AltNameList.size(); Idx < e && (AltNameList[Idx]->getName() != AltName); ++Idx) ; // If the register has an alternate name for this index, use it. // Otherwise, leave it empty as an error flag. if (Idx < e) { std::vector<std::string> AltNames = Reg.TheDef->getValueAsListOfStrings("AltNames"); if (AltNames.size() <= Idx) PrintFatalError(Reg.TheDef->getLoc(), "Register definition missing alt name for '" + AltName + "'."); AsmName = AltNames[Idx]; } } StringTable.add(AsmName); } StringTable.layout(); O << " static const char AsmStrs" << AltName << "[] = {\n"; StringTable.emit(O, printChar); O << " };\n\n"; O << " static const " << getMinimalTypeForRange(StringTable.size()-1) << " RegAsmOffset" << AltName << "[] = {"; for (unsigned i = 0, e = Registers.size(); i != e; ++i) { if ((i % 14) == 0) O << "\n "; O << StringTable.get(AsmNames[i]) << ", "; } O << "\n };\n" << "\n"; } void AsmWriterEmitter::EmitGetRegisterName(raw_ostream &O) { Record *AsmWriter = Target.getAsmWriter(); std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName"); const auto &Registers = Target.getRegBank().getRegisters(); const std::vector<Record*> &AltNameIndices = Target.getRegAltNameIndices(); bool hasAltNames = AltNameIndices.size() > 1; std::string Namespace = Registers.front().TheDef->getValueAsString("Namespace"); O << "\n\n/// getRegisterName - This method is automatically generated by tblgen\n" "/// from the register set description. This returns the assembler name\n" "/// for the specified register.\n" "const char *" << Target.getName() << ClassName << "::"; if (hasAltNames) O << "\ngetRegisterName(unsigned RegNo, unsigned AltIdx) {\n"; else O << "getRegisterName(unsigned RegNo) {\n"; O << " assert(RegNo && RegNo < " << (Registers.size()+1) << " && \"Invalid register number!\");\n" << "\n"; if (hasAltNames) { for (const Record *R : AltNameIndices) emitRegisterNameString(O, R->getName(), Registers); } else emitRegisterNameString(O, "", Registers); if (hasAltNames) { O << " switch(AltIdx) {\n" << " default: llvm_unreachable(\"Invalid register alt name index!\");\n"; for (const Record *R : AltNameIndices) { std::string AltName(R->getName()); std::string Prefix = !Namespace.empty() ? Namespace + "::" : ""; O << " case " << Prefix << AltName << ":\n" << " assert(*(AsmStrs" << AltName << "+RegAsmOffset" << AltName << "[RegNo-1]) &&\n" << " \"Invalid alt name index for register!\");\n" << " return AsmStrs" << AltName << "+RegAsmOffset" << AltName << "[RegNo-1];\n"; } O << " }\n"; } else { O << " assert (*(AsmStrs+RegAsmOffset[RegNo-1]) &&\n" << " \"Invalid alt name index for register!\");\n" << " return AsmStrs+RegAsmOffset[RegNo-1];\n"; } O << "}\n"; } namespace { // IAPrinter - Holds information about an InstAlias. Two InstAliases match if // they both have the same conditionals. In which case, we cannot print out the // alias for that pattern. class IAPrinter { std::vector<std::string> Conds; std::map<StringRef, std::pair<int, int>> OpMap; SmallVector<Record*, 4> ReqFeatures; std::string Result; std::string AsmString; public: IAPrinter(std::string R, std::string AS) : Result(R), AsmString(AS) {} void addCond(const std::string &C) { Conds.push_back(C); } void addOperand(StringRef Op, int OpIdx, int PrintMethodIdx = -1) { assert(OpIdx >= 0 && OpIdx < 0xFE && "Idx out of range"); assert(PrintMethodIdx >= -1 && PrintMethodIdx < 0xFF && "Idx out of range"); OpMap[Op] = std::make_pair(OpIdx, PrintMethodIdx); } bool isOpMapped(StringRef Op) { return OpMap.find(Op) != OpMap.end(); } int getOpIndex(StringRef Op) { return OpMap[Op].first; } std::pair<int, int> &getOpData(StringRef Op) { return OpMap[Op]; } std::pair<StringRef, StringRef::iterator> parseName(StringRef::iterator Start, StringRef::iterator End) { StringRef::iterator I = Start; StringRef::iterator Next; if (*I == '{') { // ${some_name} Start = ++I; while (I != End && *I != '}') ++I; Next = I; // eat the final '}' if (Next != End) ++Next; } else { // $name, just eat the usual suspects. while (I != End && ((*I >= 'a' && *I <= 'z') || (*I >= 'A' && *I <= 'Z') || (*I >= '0' && *I <= '9') || *I == '_')) ++I; Next = I; } return std::make_pair(StringRef(Start, I - Start), Next); } void print(raw_ostream &O) { if (Conds.empty() && ReqFeatures.empty()) { O.indent(6) << "return true;\n"; return; } O << "if ("; for (std::vector<std::string>::iterator I = Conds.begin(), E = Conds.end(); I != E; ++I) { if (I != Conds.begin()) { O << " &&\n"; O.indent(8); } O << *I; } O << ") {\n"; O.indent(6) << "// " << Result << "\n"; // Directly mangle mapped operands into the string. Each operand is // identified by a '$' sign followed by a byte identifying the number of the // operand. We add one to the index to avoid zero bytes. StringRef ASM(AsmString); SmallString<128> OutString; raw_svector_ostream OS(OutString); for (StringRef::iterator I = ASM.begin(), E = ASM.end(); I != E;) { OS << *I; if (*I == '$') { StringRef Name; std::tie(Name, I) = parseName(++I, E); assert(isOpMapped(Name) && "Unmapped operand!"); int OpIndex, PrintIndex; std::tie(OpIndex, PrintIndex) = getOpData(Name); if (PrintIndex == -1) { // Can use the default printOperand route. OS << format("\\x%02X", (unsigned char)OpIndex + 1); } else // 3 bytes if a PrintMethod is needed: 0xFF, the MCInst operand // number, and which of our pre-detected Methods to call. OS << format("\\xFF\\x%02X\\x%02X", OpIndex + 1, PrintIndex + 1); } else { ++I; } } // Emit the string. O.indent(6) << "AsmString = \"" << OutString << "\";\n"; O.indent(6) << "break;\n"; O.indent(4) << '}'; } bool operator==(const IAPrinter &RHS) const { if (Conds.size() != RHS.Conds.size()) return false; unsigned Idx = 0; for (const auto &str : Conds) if (str != RHS.Conds[Idx++]) return false; return true; } }; } // end anonymous namespace static unsigned CountNumOperands(StringRef AsmString, unsigned Variant) { std::string FlatAsmString = CodeGenInstruction::FlattenAsmStringVariants(AsmString, Variant); AsmString = FlatAsmString; return AsmString.count(' ') + AsmString.count('\t'); } namespace { struct AliasPriorityComparator { typedef std::pair<CodeGenInstAlias, int> ValueType; bool operator()(const ValueType &LHS, const ValueType &RHS) { if (LHS.second == RHS.second) { // We don't actually care about the order, but for consistency it // shouldn't depend on pointer comparisons. return LHS.first.TheDef->getName() < RHS.first.TheDef->getName(); } // Aliases with larger priorities should be considered first. return LHS.second > RHS.second; } }; } void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) { Record *AsmWriter = Target.getAsmWriter(); O << "\n#ifdef PRINT_ALIAS_INSTR\n"; O << "#undef PRINT_ALIAS_INSTR\n\n"; ////////////////////////////// // Gather information about aliases we need to print ////////////////////////////// // Emit the method that prints the alias instruction. std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName"); unsigned Variant = AsmWriter->getValueAsInt("Variant"); bool PassSubtarget = AsmWriter->getValueAsInt("PassSubtarget"); std::vector<Record*> AllInstAliases = Records.getAllDerivedDefinitions("InstAlias"); // Create a map from the qualified name to a list of potential matches. typedef std::set<std::pair<CodeGenInstAlias, int>, AliasPriorityComparator> AliasWithPriority; std::map<std::string, AliasWithPriority> AliasMap; for (Record *R : AllInstAliases) { int Priority = R->getValueAsInt("EmitPriority"); if (Priority < 1) continue; // Aliases with priority 0 are never emitted. const DagInit *DI = R->getValueAsDag("ResultInst"); const DefInit *Op = cast<DefInit>(DI->getOperator()); AliasMap[getQualifiedName(Op->getDef())].insert( std::make_pair(CodeGenInstAlias(R, Variant, Target), Priority)); } // A map of which conditions need to be met for each instruction operand // before it can be matched to the mnemonic. std::map<std::string, std::vector<IAPrinter>> IAPrinterMap; // A list of MCOperandPredicates for all operands in use, and the reverse map std::vector<const Record*> MCOpPredicates; DenseMap<const Record*, unsigned> MCOpPredicateMap; for (auto &Aliases : AliasMap) { for (auto &Alias : Aliases.second) { const CodeGenInstAlias &CGA = Alias.first; unsigned LastOpNo = CGA.ResultInstOperandIndex.size(); unsigned NumResultOps = CountNumOperands(CGA.ResultInst->AsmString, Variant); // Don't emit the alias if it has more operands than what it's aliasing. if (NumResultOps < CountNumOperands(CGA.AsmString, Variant)) continue; IAPrinter IAP(CGA.Result->getAsString(), CGA.AsmString); unsigned NumMIOps = 0; for (auto &Operand : CGA.ResultOperands) NumMIOps += Operand.getMINumOperands(); std::string Cond; Cond = std::string("MI->getNumOperands() == ") + llvm::utostr(NumMIOps); IAP.addCond(Cond); bool CantHandle = false; unsigned MIOpNum = 0; for (unsigned i = 0, e = LastOpNo; i != e; ++i) { std::string Op = "MI->getOperand(" + llvm::utostr(MIOpNum) + ")"; const CodeGenInstAlias::ResultOperand &RO = CGA.ResultOperands[i]; switch (RO.Kind) { case CodeGenInstAlias::ResultOperand::K_Record: { const Record *Rec = RO.getRecord(); StringRef ROName = RO.getName(); int PrintMethodIdx = -1; // These two may have a PrintMethod, which we want to record (if it's // the first time we've seen it) and provide an index for the aliasing // code to use. if (Rec->isSubClassOf("RegisterOperand") || Rec->isSubClassOf("Operand")) { std::string PrintMethod = Rec->getValueAsString("PrintMethod"); if (PrintMethod != "" && PrintMethod != "printOperand") { PrintMethodIdx = std::find(PrintMethods.begin(), PrintMethods.end(), PrintMethod) - PrintMethods.begin(); if (static_cast<unsigned>(PrintMethodIdx) == PrintMethods.size()) PrintMethods.push_back(PrintMethod); } } if (Rec->isSubClassOf("RegisterOperand")) Rec = Rec->getValueAsDef("RegClass"); if (Rec->isSubClassOf("RegisterClass")) { IAP.addCond(Op + ".isReg()"); if (!IAP.isOpMapped(ROName)) { IAP.addOperand(ROName, MIOpNum, PrintMethodIdx); Record *R = CGA.ResultOperands[i].getRecord(); if (R->isSubClassOf("RegisterOperand")) R = R->getValueAsDef("RegClass"); Cond = std::string("MRI.getRegClass(") + Target.getName() + "::" + R->getName() + "RegClassID)" ".contains(" + Op + ".getReg())"; } else { Cond = Op + ".getReg() == MI->getOperand(" + llvm::utostr(IAP.getOpIndex(ROName)) + ").getReg()"; } } else { // Assume all printable operands are desired for now. This can be // overridden in the InstAlias instantiation if necessary. IAP.addOperand(ROName, MIOpNum, PrintMethodIdx); // There might be an additional predicate on the MCOperand unsigned Entry = MCOpPredicateMap[Rec]; if (!Entry) { if (!Rec->isValueUnset("MCOperandPredicate")) { MCOpPredicates.push_back(Rec); Entry = MCOpPredicates.size(); MCOpPredicateMap[Rec] = Entry; } else break; // No conditions on this operand at all } Cond = Target.getName() + ClassName + "ValidateMCOperand(" + Op + ", STI, " + llvm::utostr(Entry) + ")"; } // for all subcases of ResultOperand::K_Record: IAP.addCond(Cond); break; } case CodeGenInstAlias::ResultOperand::K_Imm: { // Just because the alias has an immediate result, doesn't mean the // MCInst will. An MCExpr could be present, for example. IAP.addCond(Op + ".isImm()"); Cond = Op + ".getImm() == " + llvm::utostr(CGA.ResultOperands[i].getImm()); IAP.addCond(Cond); break; } case CodeGenInstAlias::ResultOperand::K_Reg: // If this is zero_reg, something's playing tricks we're not // equipped to handle. if (!CGA.ResultOperands[i].getRegister()) { CantHandle = true; break; } Cond = Op + ".getReg() == " + Target.getName() + "::" + CGA.ResultOperands[i].getRegister()->getName(); IAP.addCond(Cond); break; } MIOpNum += RO.getMINumOperands(); } if (CantHandle) continue; IAPrinterMap[Aliases.first].push_back(std::move(IAP)); } } ////////////////////////////// // Write out the printAliasInstr function ////////////////////////////// std::string Header; raw_string_ostream HeaderO(Header); HeaderO << "bool " << Target.getName() << ClassName << "::printAliasInstr(const MCInst" << " *MI, " << (PassSubtarget ? "const MCSubtargetInfo &STI, " : "") << "raw_ostream &OS) {\n"; std::string Cases; raw_string_ostream CasesO(Cases); for (auto &Entry : IAPrinterMap) { std::vector<IAPrinter> &IAPs = Entry.second; std::vector<IAPrinter*> UniqueIAPs; for (auto &LHS : IAPs) { bool IsDup = false; for (const auto &RHS : IAPs) { if (&LHS != &RHS && LHS == RHS) { IsDup = true; break; } } if (!IsDup) UniqueIAPs.push_back(&LHS); } if (UniqueIAPs.empty()) continue; CasesO.indent(2) << "case " << Entry.first << ":\n"; for (IAPrinter *IAP : UniqueIAPs) { CasesO.indent(4); IAP->print(CasesO); CasesO << '\n'; } CasesO.indent(4) << "return false;\n"; } if (CasesO.str().empty()) { O << HeaderO.str(); O << " return false;\n"; O << "}\n\n"; O << "#endif // PRINT_ALIAS_INSTR\n"; return; } if (!MCOpPredicates.empty()) O << "static bool " << Target.getName() << ClassName << "ValidateMCOperand(const MCOperand &MCOp,\n" << " const MCSubtargetInfo &STI,\n" << " unsigned PredicateIndex);\n"; O << HeaderO.str(); O.indent(2) << "const char *AsmString;\n"; O.indent(2) << "switch (MI->getOpcode()) {\n"; O.indent(2) << "default: return false;\n"; O << CasesO.str(); O.indent(2) << "}\n\n"; // Code that prints the alias, replacing the operands with the ones from the // MCInst. O << " unsigned I = 0;\n"; O << " while (AsmString[I] != ' ' && AsmString[I] != '\t' &&\n"; O << " AsmString[I] != '\\0')\n"; O << " ++I;\n"; O << " OS << '\\t' << StringRef(AsmString, I);\n"; O << " if (AsmString[I] != '\\0') {\n"; O << " OS << '\\t';\n"; O << " do {\n"; O << " if (AsmString[I] == '$') {\n"; O << " ++I;\n"; O << " if (AsmString[I] == (char)0xff) {\n"; O << " ++I;\n"; O << " int OpIdx = AsmString[I++] - 1;\n"; O << " int PrintMethodIdx = AsmString[I++] - 1;\n"; O << " printCustomAliasOperand(MI, OpIdx, PrintMethodIdx, "; O << (PassSubtarget ? "STI, " : ""); O << "OS);\n"; O << " } else\n"; O << " printOperand(MI, unsigned(AsmString[I++]) - 1, "; O << (PassSubtarget ? "STI, " : ""); O << "OS);\n"; O << " } else {\n"; O << " OS << AsmString[I++];\n"; O << " }\n"; O << " } while (AsmString[I] != '\\0');\n"; O << " }\n\n"; O << " return true;\n"; O << "}\n\n"; ////////////////////////////// // Write out the printCustomAliasOperand function ////////////////////////////// O << "void " << Target.getName() << ClassName << "::" << "printCustomAliasOperand(\n" << " const MCInst *MI, unsigned OpIdx,\n" << " unsigned PrintMethodIdx,\n" << (PassSubtarget ? " const MCSubtargetInfo &STI,\n" : "") << " raw_ostream &OS) {\n"; if (PrintMethods.empty()) O << " llvm_unreachable(\"Unknown PrintMethod kind\");\n"; else { O << " switch (PrintMethodIdx) {\n" << " default:\n" << " llvm_unreachable(\"Unknown PrintMethod kind\");\n" << " break;\n"; for (unsigned i = 0; i < PrintMethods.size(); ++i) { O << " case " << i << ":\n" << " " << PrintMethods[i] << "(MI, OpIdx, " << (PassSubtarget ? "STI, " : "") << "OS);\n" << " break;\n"; } O << " }\n"; } O << "}\n\n"; if (!MCOpPredicates.empty()) { O << "static bool " << Target.getName() << ClassName << "ValidateMCOperand(const MCOperand &MCOp,\n" << " const MCSubtargetInfo &STI,\n" << " unsigned PredicateIndex) {\n" << " switch (PredicateIndex) {\n" << " default:\n" << " llvm_unreachable(\"Unknown MCOperandPredicate kind\");\n" << " break;\n"; for (unsigned i = 0; i < MCOpPredicates.size(); ++i) { Init *MCOpPred = MCOpPredicates[i]->getValueInit("MCOperandPredicate"); if (StringInit *SI = dyn_cast<StringInit>(MCOpPred)) { O << " case " << i + 1 << ": {\n" << SI->getValue() << "\n" << " }\n"; } else llvm_unreachable("Unexpected MCOperandPredicate field!"); } O << " }\n" << "}\n\n"; } O << "#endif // PRINT_ALIAS_INSTR\n"; } AsmWriterEmitter::AsmWriterEmitter(RecordKeeper &R) : Records(R), Target(R) { Record *AsmWriter = Target.getAsmWriter(); unsigned Variant = AsmWriter->getValueAsInt("Variant"); // Get the instruction numbering. NumberedInstructions = Target.getInstructionsByEnumValue(); for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { const CodeGenInstruction *I = NumberedInstructions[i]; if (!I->AsmString.empty() && I->TheDef->getName() != "PHI") Instructions.emplace_back(*I, i, Variant); } } void AsmWriterEmitter::run(raw_ostream &O) { EmitPrintInstruction(O); EmitGetRegisterName(O); EmitPrintAliasInstruction(O); } namespace llvm { void EmitAsmWriter(RecordKeeper &RK, raw_ostream &OS) { emitSourceFileHeader("Assembly Writer Source Fragment", OS); AsmWriterEmitter(RK).run(OS); } } // End llvm namespace
[ "91980991+AppleOSSDistributions@users.noreply.github.com" ]
91980991+AppleOSSDistributions@users.noreply.github.com
f6af4c3e78b8b9b8a93a5ad395b9e03c57969c14
ef7b1e62182145fec5b1a1515d2427b737740a84
/Server/DBA/DBACalendars.h
63b1398f4370039eb8482e65baf47e5bb42b0ac8
[]
no_license
zanxi/Trading-yadro
732f5b3edd44d84aef50017c29e6692a27993811
481e2369e8837137a7485594e6d872f759f7d6ef
refs/heads/master
2021-02-23T10:34:53.904627
2020-03-06T11:09:24
2020-03-06T11:09:24
245,398,665
0
0
null
null
null
null
UTF-8
C++
false
false
2,810
h
#ifndef __DBA___CALENDARS__H__INCLUDED__ #define __DBA___CALENDARS__H__INCLUDED__ const LPCWSTR dbCommandGetCalendars = L"{ CALL dbo.GQA_GetAllCalendars(?, ?, ?) }"; const LPCWSTR dbCommandGetCalendarDates = L"{ ? = CALL dbo.GQA_GetAllCalendarDates(?, ?, ?) }"; const LPCWSTR dbCommandInsert = L"{? = CALL dbo.GQA_EditCalendar(?,?,?,?) }"; const LPCWSTR dbCommandInsertCDate = L"{ CALL dbo.GQA_EditCalendarDate(?,?,?,?) }"; #pragma once ///////////////////////////// Calendars ///////////////////////////////////////////////////////////////////// class CBasisCalendar { public: CBasisCalendar() { memset(this, 0, sizeof(*this)); } int Action, ReturnValue; QME::ParamDbQMECalendar m_fields = {}; }; class CCALENDAR_GetAllAccessor : public CBasisCalendar { public: DEFINE_COMMAND_EX(CCALENDAR_GetAllAccessor, dbCommandGetCalendars) BEGIN_COLUMN_MAP(CCALENDAR_GetAllAccessor) COLUMN_ENTRY(1, m_fields.CalendarId) COLUMN_ENTRY(2, m_fields.CalendarName) COLUMN_ENTRY(3, m_fields.Enabled) END_COLUMN_MAP() }; class CCALENDAR_INSAccessor2 : public CBasisCalendar { public: CCALENDAR_INSAccessor2() { memset(this, 0, sizeof(*this)); } DEFINE_COMMAND_EX(CCALENDAR_INSAccessor2, dbCommandInsert) BEGIN_PARAM_MAP(CCALENDAR_INSAccessor2) SET_PARAM_TYPE(DBPARAMIO_OUTPUT) COLUMN_ENTRY(1, ReturnValue) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(2, Action) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(3, m_fields.CalendarId) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(4, m_fields.CalendarName) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(5, m_fields.Enabled) END_PARAM_MAP() }; ///////////////////////////// CalendarDates ///////////////////////////////////////////////////////////////////// class CBasisCalendarDate { public: CBasisCalendarDate() { memset(this, 0, sizeof(*this)); } int Action; QME::ParamDbQMECalendarDate m_fields = {}; }; class CCALENDARDATE_GetAllAccessor : public CBasisCalendarDate { public: DEFINE_COMMAND_EX(CCALENDARDATE_GetAllAccessor, dbCommandGetCalendarDates); BEGIN_COLUMN_MAP(CCALENDARDATE_GetAllAccessor) COLUMN_ENTRY(1, m_fields.CalendarId) COLUMN_ENTRY(2, m_fields.Date) COLUMN_ENTRY(3, m_fields.TradeIndicator) END_COLUMN_MAP() }; class CCALENDARDATE_INSAccessor2 : public CBasisCalendarDate { public: CCALENDARDATE_INSAccessor2() { memset(this, 0, sizeof(*this)); } DEFINE_COMMAND_EX(CCALENDARDATE_INSAccessor2, dbCommandInsertCDate) BEGIN_PARAM_MAP(CCALENDARDATE_INSAccessor2) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(1, Action) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(2, m_fields.CalendarId) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(3, m_fields.Date) SET_PARAM_TYPE(DBPARAMIO_INPUT) COLUMN_ENTRY(4, m_fields.TradeIndicator) END_PARAM_MAP() }; #endif
[ "consultantweb25@gmail.com" ]
consultantweb25@gmail.com
0ffff8ab89055df35e31cf3889282307f91ece27
bdfca7d4bd6e1baf2c43e593de66fcba80afadeb
/prog-verf/assignment1/sketch-1.7.5/sketch-frontend/test/sk/seq/miniTestb357_test.cpp
b4c3113d887f74818899afac0c3720fba74c4540
[]
no_license
wanghanxiao123/Semester4
efa82fc435542809d6c1fbed46ed5fea1540787e
c37ecda8b471685b0b6350070b939d01122f5e7f
refs/heads/master
2023-03-22T06:47:16.823584
2021-03-15T10:46:53
2021-03-15T10:46:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
667
cpp
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <iostream> #include "vops.h" #include "miniTestb357.h" using namespace std; void main__Wrapper_ANONYMOUSTest(Parameters& _p_) { for(int _test_=0;_test_< _p_.niters ;_test_++) { int i; i=abs(rand()) % 32; if(_p_.verbosity > 2){ cout<<"i="<<i<<endl; } try{ ANONYMOUS::main__WrapperNospec(i); ANONYMOUS::main__Wrapper(i); }catch(AssumptionFailedException& afe){ } } } int main(int argc, char** argv) { Parameters p(argc, argv); srand(time(0)); main__Wrapper_ANONYMOUSTest(p); printf("Automated testing passed for miniTestb357\n"); return 0; }
[ "akshatgoyalak23@gmail.com" ]
akshatgoyalak23@gmail.com
6701dbc7af3e1ff7abf761981158e47eb8fc7602
b6f3cdbe8de6142f48ea5b6a0ef4a118bf300c15
/FractalTree-master/FractalTree/FractalTree Common/Game Objects/Objects/Weapon.h
5fbd45f4ef14658353afec8eefe206aebd41ba60
[]
no_license
jwang320/Engine
182042cc2b5ea8bb71fe45022296aa00dbbc4e13
5fe1d23fc695f5b43f5a484297b6448c5a446f5a
refs/heads/master
2023-01-01T12:25:18.545583
2020-10-28T00:45:05
2020-10-28T00:45:05
307,857,598
0
0
null
null
null
null
UTF-8
C++
false
false
341
h
#pragma once #include "../Common Source/Simulation Engine/Physical Simulation/Item.h" namespace SimulationEngine { class Weapon : public Item { protected: long long lastUseTime; long long coolDown; public: void ShootWeapon(); protected: Weapon(Actor* owner = NULL, long long coolDown = 100); virtual void Shoot() = 0; }; }
[ "73551517+jwang320@users.noreply.github.com" ]
73551517+jwang320@users.noreply.github.com
aef1cf5f008075079283953a6f87c371939d36d5
1da7d378d84fb995bf118e94839a4131a178499b
/sinkworld/tentacle/python/add_Substance.cpp
4de8f32ccd6cf1c914d7c1b58e9d01d09db46cf8
[ "MIT" ]
permissive
calandoa/zxite
f85ed7b8cc0f3ed5194b5ea3c4ce5859cb487312
8122da2e5dc2907ccb84fe295a9a86e843402378
refs/heads/master
2021-07-14T21:14:16.559063
2017-10-20T16:12:09
2017-10-20T16:12:09
28,239,704
0
1
null
null
null
null
UTF-8
C++
false
false
2,802
cpp
#include <boost/python.hpp> #include <boost/cstdint.hpp> #include <string> #include <iostream> #include <assert.h> #include "base.h" // Using ======================================================================= using namespace boost::python; #include "bbase.h" void add_Substance() { class_< Substance, bases< SplitVector_1 > , boost::noncopyable, Substance_Wrapper >("Substance", init< >()) .def_readwrite("bytesInUnit", &Substance::bytesInUnit) .def("DistanceNextCaret", pure_virtual(&Substance::DistanceNextCaret)) .def("LenChar", pure_virtual(&Substance::LenChar)) .def("LenCharacters", pure_virtual(&Substance::LenCharacters)) .def("BytesFromCharacters", pure_virtual(&Substance::BytesFromCharacters)) .def("RetrieveUTF8", pure_virtual(&Substance::RetrieveUTF8)) .def("RetrieveUTF16", pure_virtual(&Substance::RetrieveUTF16)) .def("RetrieveUTF32", pure_virtual(&Substance::RetrieveUTF32)) .def("LengthInText", pure_virtual(&Substance::LengthInText)) .def("UnitValue", pure_virtual(&Substance::UnitValue)) .def("UnitFromArray", pure_virtual(&Substance::UnitFromArray)) .def("CharValue", pure_virtual(&Substance::CharValue)) .def("MovePositionOutsideChar", pure_virtual(&Substance::MovePositionOutsideChar)) .def("BetweenCharacters", pure_virtual(&Substance::BetweenCharacters)) .def("ValidateRange", pure_virtual(&Substance::ValidateRange)) .def("ValidateArray", pure_virtual(&Substance::ValidateArray)) .def("ValueAt", (int (SplitVector_1::*)(int) )&SplitVector_1::ValueAt, (int (Substance_Wrapper::*)(int))&Substance_Wrapper::default_ValueAt) .def("FindNextChange", (int (SplitVector_1::*)(int, int) )&SplitVector_1::FindNextChange, (int (Substance_Wrapper::*)(int, int))&Substance_Wrapper::default_FindNextChange) .def("Length", (int (SplitVector_1::*)() )&SplitVector_1::Length, (int (Substance_Wrapper::*)())&Substance_Wrapper::default_Length) .def("InsertSpace", (void (SplitVector_1::*)(int, int) )&SplitVector_1::InsertSpace, (void (Substance_Wrapper::*)(int, int))&Substance_Wrapper::default_InsertSpace) .def("FillRange", (void (SplitVector_1::*)(int, int, int) )&SplitVector_1::FillRange, (void (Substance_Wrapper::*)(int, int, int))&Substance_Wrapper::default_FillRange) .def("DeleteRange", (void (SplitVector_1::*)(int, int) )&SplitVector_1::DeleteRange, (void (Substance_Wrapper::*)(int, int))&Substance_Wrapper::default_DeleteRange) .def("DeleteAll", (void (SplitVector_1::*)() )&SplitVector_1::DeleteAll, (void (Substance_Wrapper::*)())&Substance_Wrapper::default_DeleteAll) .def("UnsignedByteAt", &Substance::UnsignedByteAt) .def("IsCrLf", &Substance::IsCrLf) ; }
[ "antoine.calando@intel.com" ]
antoine.calando@intel.com
2c1302fc4e404c58771b8cc266a8b61e7f1b7b1a
39eac74fa6a244d15a01873623d05f480f45e079
/LabResultsTabDlg.cpp
3321068226c3894a6e81788765e3c92ae8dfc376
[]
no_license
15831944/Practice
a8ac8416b32df82395bb1a4b000b35a0326c0897
ae2cde9c8f2fb6ab63bd7d8cd58701bd3513ec94
refs/heads/master
2021-06-15T12:10:18.730367
2016-11-30T15:13:53
2016-11-30T15:13:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
373,876
cpp
// LabResultsTabDlg.cpp : implementation file // #include "stdafx.h" #include "PatientsRc.h" #include "LabResultsTabDlg.h" #include "LabsSetupDlg.h" #include "InternationalUtils.h" #include "AuditTrail.h" #include "RenameFileDlg.h" #include "MultiSelectDlg.h" #include "EditLabResultsDlg.h" #include "LabEditDiagnosisDlg.h" #include "EditComboBox.h" #include "LabEntryDlg.h" #include "MsgBox.h" #include "EditLabStatusDlg.h" #include "DecisionRuleUtils.h" #include "SignatureDlg.h" #include "NotesDlg.h" // (j.dinatale 2010-12-27) - PLID 41591 #include "NxModalParentDlg.h" // (j.dinatale 2010-12-27) - PLID 41591 #include "HL7Utils.h" #include "ConfigureReportViewDlg.h" #include "SingleSelectMultiColumnDlg.h" // (j.dinatale 2013-03-04 15:58) - PLID 34339 #include "MedlinePlusUtils.h" #include "MovePatientLabsDlg.h" #include "NxAPI.h" using namespace NXDATALIST2Lib; using namespace ADODB; // (a.walling 2010-01-21 16:43) - PLID 37024 - Modified all auditing to take in a patient's internal ID when applicable, -1 if not. // (b.spivey, July 10, 2013) - PLID 45194 - Some quick, arbitrary defines so we don't have magic numbers floating around. #define ID_SCAN_IMAGE 45194 #define ID_SCAN_PDF 45195 #define ID_SCAN_MULTIPDF 45196 // CLabResultsTabDlg dialog //TES 11/20/2009 - PLID 36191 - Created. The vast majority of code in this file was copied from LabEntryDlg.cpp enum LabFlagColumns{ lfcFlagID = 0, lfcName, lfcTodoPriority, //TES 8/6/2013 - PLID 51147 }; enum LabDescListColumns { ldlcLabID = 0, ldlcDiagID = 1, ldlcDesc = 2, }; enum ClinicalDiagListColumns { cdlcLabID = 0, cdlcDiagID = 1, cdlcDesc = 2, }; enum ClinicalDiagOptionsListColumns { cdolcID = 0, cdolcDesc = 1, cdolcDescForSorting = 2, cdolcHasLink = 3, }; // (r.goldschmidt 2016-02-25 09:54) - PLID 68267 - possible values for has link field of clinical diag options list enum FilterValues { fvNoLink = 0, fvHasLink = 1, fvSpecialShowAll = 2, }; //TES 12/1/2008 - PLID 32191 enum LabStatusColumns{ lscStatusID = 0, lscDescription, }; //TES 5/2/2011 - PLID 43428 enum OrderStatusColumns { oscID = 0, oscDescription = 1, oscHL7Flag = 2, }; IMPLEMENT_DYNAMIC(CLabResultsTabDlg, CNxDialog) CLabResultsTabDlg::CLabResultsTabDlg(CLabEntryDlg *pParentDlg) : CNxDialog(CLabResultsTabDlg::IDD, pParentDlg) { m_pLabEntryDlg = pParentDlg; m_nPatientID = -1; m_nInitialLabID = -1; m_nLabProcedureID = -1; m_ltType = ltInvalid; m_bControlsHidden = false; // (c.haag 2011-12-28) - PLID 41618 m_pLabResultsAttachmentView = NULL; m_bLoadedResultFieldPositions = false; m_drsThis = new DialogRowStruct; // (b.spivey, July 18, 2013) - PLID 45194 } CLabResultsTabDlg::~CLabResultsTabDlg() { // (a.walling 2011-06-22 11:59) - PLID 44260 - This should all be done in OnDestroy, not the destructor. } void CLabResultsTabDlg::OnDestroy() { // (a.walling 2011-06-22 11:59) - PLID 44260 - Cleanup everything now that the window is going away try { // (r.gonet 06/12/2014) - PLID 40426 - Free the memory used by both maps. ClearResultsMap(); ClearAttachedFilesMap(); //unload any HTML reports UnloadHTMLReports(); if (NULL != m_pLabResultsAttachmentView) { delete m_pLabResultsAttachmentView; m_pLabResultsAttachmentView = NULL; } // (b.spivey, July 17, 2013) - PLID 45194 - Make sure this gets deleted when we destroy the dialog. delete m_drsThis; m_drsThis = NULL; } NxCatchAll(__FUNCTION__) CNxDialog::OnDestroy(); } // (c.haag 2011-01-27) - PLID 41618 - Returns the time on the server COleDateTime CLabResultsTabDlg::GetServerTime() { ADODB::_RecordsetPtr rs = CreateRecordset("SELECT GetDate() AS Now"); return AdoFldDateTime(rs->Fields, "Now"); // We want an exception to be thrown if this is somehow eof } // (c.haag 2010-11-22 15:39) - PLID 40556 - Returns the number of results for the current lab // (z.manning 2011-06-17 10:36) - PLID 44154 - This now returns all the result rows //TES 11/6/2012 - PLID 53591 - Provide options to return rows for all specimens, only the current specimen, or check the preference void CLabResultsTabDlg::GetResults(long nLabID, OUT CArray<NXDATALIST2Lib::IRowSettingsPtr,NXDATALIST2Lib::IRowSettingsPtr> &arypResultRows, GetResultOptions gro) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; //TES 11/6/2012 - PLID 53591 - Include all results if a.) we're in the PDF view, b.) we've been explicitly told to, or c.) we've been told // to check the preference, and the preference says to do so. if(bInPDFView || gro == groAllSpecimens || (gro == groCheckPreference && GetRemotePropertyInt("SignAndAcknowledgeResultsForAllSpecimens", 0, 0, "<None>"))) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return; } arypLabRows.Add(pLabRow); } long nCount = 0; for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pResultRow = pLabRow->GetFirstChildRow(); while (pResultRow) { nCount++; // (z.manning 2011-06-17 10:45) - PLID 44154 - We now return the result rows to the caller arypResultRows.Add(pResultRow); pResultRow = pResultRow->GetNextRow(); } } } // (c.haag 2010-11-23 16:17) - PLID 37372 - Returns TRUE if all the results for a specific lab are signed BOOL CLabResultsTabDlg::AllResultsAreSigned(long nLabID) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; //TES 11/6/2012 - PLID 53591 - There's a preference now to sign/acknowledge all specimens if(bInPDFView || GetRemotePropertyInt("SignAndAcknowledgeResultsForAllSpecimens", 0, 0, "<None>")) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return FALSE; // No results, no signatures to view } arypLabRows.Add(pLabRow); } for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pResultRow = pLabRow->GetFirstChildRow(); while (pResultRow) { if (pResultRow->GetValue(lrtcSignatureInkData).vt == VT_NULL) { return FALSE; } pResultRow = pResultRow->GetNextRow(); } } return TRUE; } // (c.haag 2010-12-02 09:59) - PLID 38633 - Returns TRUE if all the results for a specific lab are marked completed BOOL CLabResultsTabDlg::AllResultsAreCompleted(long nLabID) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; if(bInPDFView) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return FALSE; // No results to complete } arypLabRows.Add(pLabRow); } for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pResultRow = pLabRow->GetFirstChildRow(); while (pResultRow) { if (-1 == VarLong(pResultRow->GetValue(lrtcCompletedBy), -1)) { return FALSE; } pResultRow = pResultRow->GetNextRow(); } } return TRUE; } // (c.haag 2010-12-10 10:19) - PLID 40556 - Returns TRUE if all the results for a specific lab are acknowledged BOOL CLabResultsTabDlg::AllResultsAreAcknowledged(long nLabID) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; //TES 11/6/2012 - PLID 53591 - There's a preference now to sign/acknowledge all specimens if(bInPDFView || GetRemotePropertyInt("SignAndAcknowledgeResultsForAllSpecimens", 0, 0, "<None>")) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return FALSE; // No results to acknowledge } arypLabRows.Add(pLabRow); } for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pResultRow = pLabRow->GetFirstChildRow(); while (pResultRow) { if (GetTreeValue(pResultRow, lrfAcknowledgedBy, lrtcForeignKeyID).vt == VT_NULL) { return FALSE; } pResultRow = pResultRow->GetNextRow(); } } return TRUE; } // (z.manning 2011-06-21 17:09) - PLID 44154 void CLabResultsTabDlg::GetUniqueSignatures(IN const CArray<IRowSettingsPtr,IRowSettingsPtr> &arypResultRows, OUT CLabCompletionInfoArray &aryLabSignatures) { for(int nRowIndex = 0; nRowIndex < arypResultRows.GetCount(); nRowIndex++) { IRowSettingsPtr pResultRow = arypResultRows.GetAt(nRowIndex); LabCompletionInfo sig; sig.nUserID = VarLong(pResultRow->GetValue(lrtcSignedBy), -1); sig.dtDate = VarDateTime(pResultRow->GetValue(lrtcSignedDate), g_cdtInvalid); sig.dtDate.SetDateTime(sig.dtDate.GetYear(), sig.dtDate.GetMonth(), sig.dtDate.GetDay(), sig.dtDate.GetHour(), sig.dtDate.GetMinute(), 0); if(!aryLabSignatures.AlreadyExists(sig)) { aryLabSignatures.Add(sig); } } } // (c.haag 2010-11-23 16:17) - PLID 37372 - Formats the Signature button based on the current requisition and // whether it has been signed // (c.haag 2011-02-21) - PLID 41618 - We now pass in the active row. It can be a result, or a specimen, or null. void CLabResultsTabDlg::FormatSignButtonText(IRowSettingsPtr pActiveRow) { long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); BOOL bAllResultsSigned = AllResultsAreSigned(nLabID); // (f.gelderloos 2013-08-28 16:29) - PLID 57826 BOOL bAllResultsAcknowledged = AllResultsAreAcknowledged(nLabID); CArray<IRowSettingsPtr,IRowSettingsPtr> arypUnsignedResultRows; GetUnsignedResults(nLabID, arypUnsignedResultRows); // (c.haag 2011-02-21) - PLID 41618 - Update the static labels // (z.manning 2011-06-21 16:46) - PLID 44154 - Improved this to not be so dependent on the tree. { if (!bAllResultsSigned || arypResultRows.GetCount() == 0) { // (z.manning 2011-06-21 16:56) - PLID 44154 - There are either no results or some unsigned results in which // case let's set this to blank. SetDlgItemText(IDC_LAB_SIGNED_BY, ""); m_nxstaticSignedByLabel.SetWindowText(""); m_nxstaticLabSignedBy.SetToolTip(""); } else { // (z.manning 2011-06-21 17:32) - PLID 44154 - All results are signed. Let's get a list of all unique signatures // and display info about them. CLabCompletionInfoArray aryLabSignatures; GetUniqueSignatures(arypResultRows, aryLabSignatures); CString strSignedByText; for(int nSigIndex = 0; nSigIndex < aryLabSignatures.GetCount(); nSigIndex++) { LabCompletionInfo sig = aryLabSignatures.GetAt(nSigIndex); strSignedByText += GetExistingUserName(sig.nUserID) + " at " + FormatDateTimeForInterface(sig.dtDate, DTF_STRIP_SECONDS, dtoDateTime) + ", "; } strSignedByText.TrimRight(", "); m_nxstaticLabSignedBy.SetWindowText(strSignedByText); m_nxstaticLabSignedBy.SetToolTip(strSignedByText); m_nxstaticSignedByLabel.SetWindowText("Signed By:"); } } if (-2 == nLabID || 0 == arypResultRows.GetCount()) { // If no lab is selected or we have no results, change the window text to hint at the purpose of the signature button, // but disable the button until a lab is later selected. SetDlgItemText(IDC_LAB_SIGNATURE, "Sign Results"); GetDlgItem(IDC_LAB_SIGNATURE)->EnableWindow(FALSE); return; } else { GetDlgItem(IDC_LAB_SIGNATURE)->EnableWindow(TRUE); } // Update the button color. If at least one result needs signed, then it should be red. Otherwise, black. if (arypResultRows.GetCount() > 0 && !bAllResultsSigned) { m_signatureBtn.SetTextColor(RGB(255,0,0)); } else { m_signatureBtn.SetTextColor(RGB(0,0,0)); } if (1 == arypResultRows.GetCount()) { if (arypResultRows.GetAt(0)->GetValue(lrtcSignatureInkData).vt != VT_NULL) { GetDlgItem(IDC_LAB_SIGNATURE)->SetWindowText("View Signature"); GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(FALSE); // (j.luckoski 2013-03-21 10:42) - PLID 55424 - Hide upon this case } else { GetDlgItem(IDC_LAB_SIGNATURE)->SetWindowText("Sign Result"); } } else { // Multiple results. From here, we want the user to do one of the following: // - View the current signature if one exists // - Sign results // If all results are signed, deal only with viewing signatures if (bAllResultsSigned) { SetDlgItemText(IDC_LAB_SIGNATURE, "View Signature"); GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(FALSE); // (j.luckoski 2013-03-21 10:42) - PLID 55424 - Hide GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(FALSE); // (f.gelderloos 2013-08-26 10:41) - PLID 57826 } else if (arypUnsignedResultRows.GetSize() >= arypResultRows.GetSize()) { // The current result has no signature. We'll give the option to sign multiple results. GetDlgItem(IDC_LAB_SIGNATURE)->SetWindowText("Sign Results"); } else { // The current result has a signature. Let the user decide whether to view the signature in a // context menu. SetDlgItemText(IDC_LAB_SIGNATURE, "Signature Actions"); } } // (f.gelderloos 2013-08-26 10:55) - PLID 57826 if(!bAllResultsAcknowledged && !bAllResultsSigned) { GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(TRUE); } else { GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(FALSE); } } // (z.manning 2011-06-21 17:09) - PLID 44154 void CLabResultsTabDlg::GetUniqueCompletionInfo(IN const CArray<IRowSettingsPtr,IRowSettingsPtr> &arypResultRows, OUT CLabCompletionInfoArray &aryCompletionInfo) { for(int nRowIndex = 0; nRowIndex < arypResultRows.GetCount(); nRowIndex++) { IRowSettingsPtr pResultRow = arypResultRows.GetAt(nRowIndex); LabCompletionInfo info; info.nUserID = VarLong(pResultRow->GetValue(lrtcCompletedBy), -1); info.dtDate = VarDateTime(pResultRow->GetValue(lrtcCompletedDate), g_cdtInvalid); info.dtDate.SetDateTime(info.dtDate.GetYear(), info.dtDate.GetMonth(), info.dtDate.GetDay(), info.dtDate.GetHour(), info.dtDate.GetMinute(), 0); if(!aryCompletionInfo.AlreadyExists(info)) { aryCompletionInfo.Add(info); } } } // (c.haag 2010-12-02 10:28) - PLID 38633 - Formats the Completed button based on the current requisition and // whether it has been completed // (c.haag 2011-02-21) - PLID 41618 - Now takes in a row. pActiveRow can be a result or a specimen or null. void CLabResultsTabDlg::FormatMarkCompletedButtonText(IRowSettingsPtr pActiveRow) { long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); BOOL bAllResultsCompleted = AllResultsAreCompleted(nLabID); // (c.haag 2011-02-21) - PLID 41618 - Update the static labels { if (!bAllResultsCompleted || arypResultRows.GetCount() == 0) { // (z.manning 2011-06-21 16:56) - PLID 44154 - There are either no results or some incomplete results in which // case let's set this to blank. SetDlgItemText(IDC_LAB_COMPLETED_BY, ""); m_nxstaticCompletedByLabel.SetWindowText(""); m_nxstaticLabCompletedBy.SetToolTip(""); } else { // (z.manning 2011-06-21 17:32) - PLID 44154 - All results are complete. Let's get a list of all unique completion info // and display info about them. CLabCompletionInfoArray aryCompletionInfo; GetUniqueCompletionInfo(arypResultRows, aryCompletionInfo); CString strSignedByText; for(int nCompletionInfoIndex = 0; nCompletionInfoIndex < aryCompletionInfo.GetCount(); nCompletionInfoIndex++) { LabCompletionInfo info = aryCompletionInfo.GetAt(nCompletionInfoIndex); strSignedByText += GetExistingUserName(info.nUserID) + " at " + FormatDateTimeForInterface(info.dtDate, DTF_STRIP_SECONDS, dtoDateTime) + ", "; } strSignedByText.TrimRight(", "); m_nxstaticLabCompletedBy.SetWindowText(strSignedByText); m_nxstaticLabCompletedBy.SetToolTip(strSignedByText); m_nxstaticCompletedByLabel.SetWindowText("Completed By:"); } } // This will always be the window text SetDlgItemText(IDC_LAB_MARK_COMPLETED, "Mark Lab\nCompleted"); if (-2 == nLabID || 0 == arypResultRows.GetCount()) { // If no lab is selected or we have no results, change the window text to hint at the purpose of the button, // but disable the button until a lab is later selected. GetDlgItem(IDC_LAB_MARK_COMPLETED)->EnableWindow(FALSE); return; } else { GetDlgItem(IDC_LAB_MARK_COMPLETED)->EnableWindow(TRUE); } // Update the button color. If at least one result needs completed, then it should be red. Otherwise, black. if (!bAllResultsCompleted) { m_markCompletedBtn.SetTextColor(RGB(255,0,0)); } else { m_markCompletedBtn.SetTextColor(RGB(0,0,0)); } // If all results are completed, disable the button if (bAllResultsCompleted) { GetDlgItem(IDC_LAB_MARK_COMPLETED)->EnableWindow(FALSE); GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(FALSE); // (j.luckoski 2013-03-21 10:43) - PLID 55424 - Hide } } // (j.luckoski 2013-03-21 10:46) - PLID 55424 - Formats button to be visible or not. Name is a little misleading but I am // sure eventually someone will have to make it say or do something else. void CLabResultsTabDlg::FormatMarkAllCompleteButtonText(IRowSettingsPtr pActiveRow) { long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); BOOL bAllResultsCompleted = AllResultsAreCompleted(nLabID); BOOL bAllResultsSigned = AllResultsAreSigned(nLabID); BOOL bAllResultsAcknowledged = AllResultsAreAcknowledged(nLabID); if(!bAllResultsCompleted && !bAllResultsAcknowledged && !bAllResultsSigned && -2 != nLabID ) { GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(TRUE); } else { GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(FALSE); } } // (f.gelderloos 2013-08-28 15:58) - PLID 57826 Add formatting handling for the Acknowledge and Sign button void CLabResultsTabDlg::FormatAcknowledgeAndSignButtonText(IRowSettingsPtr pActiveRow) { long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); BOOL bAllResultsCompleted = AllResultsAreCompleted(nLabID); BOOL bAllResultsSigned = AllResultsAreSigned(nLabID); BOOL bAllResultsAcknowledged = AllResultsAreAcknowledged(nLabID); int x = arypResultRows.GetCount(); // (f.gelderloos 2013-08-26 10:55) - PLID 57826 if(!bAllResultsAcknowledged && !bAllResultsSigned && (-2 != nLabID)) { GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(TRUE); } else { GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(FALSE); } } // (z.manning 2011-06-21 17:09) - PLID 44154 void CLabResultsTabDlg::GetUniqueAcknowledgers(IN const CArray<NXDATALIST2Lib::IRowSettingsPtr,NXDATALIST2Lib::IRowSettingsPtr> &arypResultRows, OUT CLabCompletionInfoArray &arystrAcknowledgers) { for(int nRowIndex = 0; nRowIndex < arypResultRows.GetCount(); nRowIndex++) { IRowSettingsPtr pResultRow = arypResultRows.GetAt(nRowIndex); LabCompletionInfo info; info.nUserID = VarLong(GetTreeValue(pResultRow, lrfAcknowledgedBy, lrtcForeignKeyID), -1); info.dtDate = VarDateTime(GetTreeValue(pResultRow, lrfAcknowledgedOn, lrtcValue), g_cdtInvalid); info.dtDate.SetDateTime(info.dtDate.GetYear(), info.dtDate.GetMonth(), info.dtDate.GetDay(), info.dtDate.GetHour(), info.dtDate.GetMinute(), 0); if(!arystrAcknowledgers.AlreadyExists(info)) { arystrAcknowledgers.Add(info); } } } // (c.haag 2010-11-22 15:39) - PLID 40556 - Formats the Acknowledged button text based on the number // of results and the state of the results. // (c.haag 2011-02-21) - PLID 41618 - Now takes in a row. pActiveRow can be a result or a specimen or null. void CLabResultsTabDlg::FormatAcknowledgedButtonText(IRowSettingsPtr pActiveRow) { long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); BOOL bAllResultsAcknowledged = AllResultsAreAcknowledged(nLabID); BOOL bAllResultsSigned = AllResultsAreSigned(nLabID); // (c.haag 2011-02-23) - PLID 41618 - Update the acknowledged labels { if (!bAllResultsAcknowledged || arypResultRows.GetCount() == 0) { // (z.manning 2011-06-21 16:56) - PLID 44154 - There are either no results or some unacknowledged results in which // case let's set this to blank. m_nxstaticAcknowledgedBy.SetWindowText(""); // (c.haag 2010-11-22 15:39) - PLID 40556 - New Acknowledged controls m_nxstaticAcknowledgedByLabel.SetWindowText(""); m_nxstaticAcknowledgedBy.SetToolTip(""); } else { // (z.manning 2011-06-21 17:32) - PLID 44154 - All results are acknowledged. Let's get a list of all unique acknowledgers // and display info about them. CLabCompletionInfoArray aryAcknowledgeInfo; GetUniqueAcknowledgers(arypResultRows, aryAcknowledgeInfo); CString strSignedByText; for(int nAcknowledgeInfoIndex = 0; nAcknowledgeInfoIndex < aryAcknowledgeInfo.GetCount(); nAcknowledgeInfoIndex++) { LabCompletionInfo info = aryAcknowledgeInfo.GetAt(nAcknowledgeInfoIndex); strSignedByText += GetExistingUserName(info.nUserID) + " at " + FormatDateTimeForInterface(info.dtDate, DTF_STRIP_SECONDS, dtoDateTime) + ", "; } strSignedByText.TrimRight(", "); m_nxstaticAcknowledgedBy.SetWindowText(strSignedByText); m_nxstaticAcknowledgedBy.SetToolTip(strSignedByText); // (c.haag 2010-11-22 15:39) - PLID 40556 - New Acknowledged controls m_nxstaticAcknowledgedByLabel.SetWindowText("Acknowledged By:"); } } if (-2 == nLabID || 0 == arypResultRows.GetCount()) { // If no lab is selected or we have no results, change the window text to hint at the purpose of the button, // but disable the button until a lab is later selected. SetDlgItemText(IDC_LAB_ACKNOWLEDGE, "Acknowledge Results"); GetDlgItem(IDC_LAB_ACKNOWLEDGE)->EnableWindow(FALSE); return; } // Now update the button text and enable the button based on the current selection and result count. // When we get here, we KNOW there is a lab selected and we KNOW it has results. if (1 == arypResultRows.GetCount()) { if (VT_NULL != GetTreeValue(arypResultRows.GetAt(0), lrfAcknowledgedBy, lrtcForeignKeyID).vt) { // Already acknowledged. This is effectively a reset button. SetDlgItemText(IDC_LAB_ACKNOWLEDGE, "Unacknowledge Result"); GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(FALSE); // (j.luckoski 2013-03-21 10:47) - PLID 55424 } else { SetDlgItemText(IDC_LAB_ACKNOWLEDGE, "Acknowledge Result"); } GetDlgItem(IDC_LAB_ACKNOWLEDGE)->EnableWindow(TRUE); } else { // Special handling for when all results are acknowledged if (bAllResultsAcknowledged) { // If all results are acknowledged and no result is selected, there's nothing we can do SetDlgItemText(IDC_LAB_ACKNOWLEDGE, "Unacknowledge Result"); GetDlgItem(IDC_LAB_ACKNOWLEDGE)->EnableWindow(TRUE); GetDlgItem(IDC_LAB_MARK_ALL_COMPLETE)->EnableWindow(FALSE); // (j.luckoski 2013-03-21 10:47) - PLID 55424 } else { // If we get here, one or more results are not acknowledged. No matter what the // result selection is, we want them to be able to acknowledge anything that is not // already acknowledged. If we have a valid result selected and it's acknowledged, we // need to be able to unacknowledge it. // CArray<IRowSettingsPtr,IRowSettingsPtr> arypUnacknowledgedResults; GetUnacknowledgedResults(nLabID, arypUnacknowledgedResults); if (arypUnacknowledgedResults.GetSize() < arypResultRows.GetSize()) { // In the special case where a result is selected and it was acknowledged, we'll let the // user unacknowledge it. SetDlgItemText(IDC_LAB_ACKNOWLEDGE, "Acknowledgement Actions"); } else { // In all other cases, just let them acknowledge results SetDlgItemText(IDC_LAB_ACKNOWLEDGE, "Acknowledge Results"); } GetDlgItem(IDC_LAB_ACKNOWLEDGE)->EnableWindow(TRUE); } } // (f.gelderloos 2013-08-26 10:55) - PLID 57826 if(!bAllResultsAcknowledged && !bAllResultsSigned) { GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(TRUE); } else { GetDlgItem(IDC_LAB_ACKNOWLEDGEANDSIGN)->EnableWindow(FALSE); } } void CLabResultsTabDlg::DoDataExchange(CDataExchange* pDX) { CNxDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_DOC_PATH_LINK, m_nxlDocPath); DDX_Control(pDX, IDC_VALUE_LABEL, m_nxstaticValueLabel); DDX_Control(pDX, IDC_UNITS_LABEL, m_nxstaticUnitsLabel); DDX_Control(pDX, IDC_SLIDE_NUMBER_LABEL, m_nxstaticSlideLabel); DDX_Control(pDX, IDC_RESULT_NAME_LABEL, m_nxstaticNameLabel); DDX_Control(pDX, IDC_RESULT_LOINC_LABEL, m_nxlabelLOINC); // (a.walling 2010-01-18 10:38) - PLID 36936 DDX_Control(pDX, IDC_REFERENCE_LABEL, m_nxstaticRefLabel); DDX_Control(pDX, IDC_RESULT_COMMENTS_LABEL, m_nxstaticResultCommentsLabel); DDX_Control(pDX, IDC_MICRO_DESC_LABEL, m_nxstaticMicroDesLabel); DDX_Control(pDX, IDC_FLAG_LABEL, m_nxstaticFlagLabel); DDX_Control(pDX, IDC_DIAGNOSIS_LABEL, m_nxstaticDiagnosisLabel); DDX_Control(pDX, IDC_DATE_RECEIVED_LABEL, m_nxstaticDateReceived); DDX_Control(pDX, IDC_ATTACH_FILE, m_btnAttachDoc); DDX_Control(pDX, IDC_DETACH_FILE, m_btnDetachDoc); DDX_Control(pDX, IDC_DELETE_RESULT, m_btnDeleteResult); DDX_Control(pDX, IDC_ADD_RESULT, m_btnAddResult); DDX_Control(pDX, IDC_BTN_ADD_DIAGNOSIS, m_btnAddDiagnosis); DDX_Control(pDX, IDC_DATE_RECEIVED, m_dtpDateReceived); DDX_Control(pDX, IDC_SLIDE_NUMBER, m_nxeditSlideNumber); DDX_Control(pDX, IDC_LAB_DIAG_DESCRIPTION, m_nxeditLabDiagDescription); DDX_Control(pDX, IDC_CLINICAL_DIAGNOSIS_DESC, m_nxeditClinicalDiagnosisDesc); DDX_Control(pDX, IDC_LAB_RESULT_LABEL, m_nxstaticLabResultLabel); DDX_Control(pDX, IDC_EDIT_FLAG, m_EditFlagBtn); DDX_Control(pDX, IDC_EDIT_LAB_DIAGNOSES, m_EditLabDiagnosesBtn); DDX_Control(pDX, IDC_EDIT_CLINICAL_DIAGNOSIS_LIST, m_EditClinicalDiagnosisList); DDX_Control(pDX, IDC_EDIT_RESULT_STATUS, m_nxbEditStatus); DDX_Control(pDX, IDC_RESULT_NAME, m_nxeditResultName); DDX_Control(pDX, IDC_RESULT_LOINC, m_nxeditResultLOINC); // (a.walling 2010-01-18 10:38) - PLID 36936 DDX_Control(pDX, IDC_RESULT_REFERENCE, m_nxeditResultReference); DDX_Control(pDX, IDC_RESULT_VALUE, m_nxeditResultValue); DDX_Control(pDX, IDC_RESULT_UNITS, m_nxeditResultUnits); DDX_Text(pDX, IDC_RESULT_UNITS, m_strResultUnits); DDV_MaxChars(pDX, m_strResultUnits, 250); DDX_Control(pDX, IDC_RESULT_COMMENTS, m_nxeditResultComments); DDX_Control(pDX, IDC_ATTACHED_FILE_LABEL, m_nxstaticAttachedFileLabel); DDX_Control(pDX, IDC_ZOOM, m_btnZoom); DDX_Control(pDX, IDC_LAB_MARK_COMPLETED, m_markCompletedBtn); DDX_Control(pDX, IDC_LAB_MARK_ALL_COMPLETE, m_markAllCompleteBtn); // (j.luckoski 2013-03-21 10:48) - PLID 55424 DDX_Control(pDX, IDC_LAB_ACKNOWLEDGEANDSIGN, m_AcknowledgeAndSignBtn);// (f.gelderloos 2013-08-26 10:57) - PLID 57826 DDX_Control(pDX, IDC_LAB_SIGNATURE, m_signatureBtn); // (c.haag 2010-11-22 13:49) - PLID 37372 DDX_Control(pDX, IDC_LAB_COMPLETED_BY, m_nxstaticLabCompletedBy); // (j.dinatale 2010-12-13) - PLID 41777 - No longer need the completed date label //DDX_Control(pDX, IDC_LAB_RESULT_COMPLETED_DATE, m_nxstaticLabCompletedDate); // (c.haag 2010-12-02 16:23) - PLID 38633 DDX_Control(pDX, IDC_COMPLETED_BY_LABEL, m_nxstaticCompletedByLabel); // (c.haag 2010-12-02 16:23) - PLID 38633 // (j.dinatale 2010-12-13) - PLID 41777 - No longer need the completed date heading label //DDX_Control(pDX, IDC_COMPLETED_RESULT_DATE_LABEL, m_nxstaticCompletedDateLabel); // (c.haag 2010-12-02 16:23) - PLID 38633 DDX_Control(pDX, IDC_ACKNOWLEDGED_BY_LABEL, m_nxstaticAcknowledgedByLabel); // (c.haag 2010-11-22 15:39) - PLID 40556 DDX_Control(pDX, IDC_ACKNOWLEDGED, m_nxstaticAcknowledgedBy); DDX_Control(pDX, IDC_SIGNED_BY_LABEL, m_nxstaticSignedByLabel); // (c.haag 2010-11-23 11:19) - PLID 37372 // (j.dinatale 2010-12-13) - PLID 41777 - No longer need the signed date heading label //DDX_Control(pDX, IDC_SIGNED_DATE_LABEL, m_nxstaticSignedDateLabel); DDX_Control(pDX, IDC_LAB_SIGNED_BY, m_nxstaticLabSignedBy); // (c.haag 2010-11-23 11:19) - PLID 37372 // (j.dinatale 2010-12-13) - PLID 41777 - No longer need the signed date label //DDX_Control(pDX, IDC_LAB_SIGNED_DATE, m_nxstaticLabSignedDate); DDX_Control(pDX, IDC_SCROLL_LEFT, m_btnScrollLeft); // (j.gruber 2010-11-24 11:28) - PLID 41607 DDX_Control(pDX, IDC_SCROLL_RIGHT, m_btnScrollRight); // (j.gruber 2010-11-24 11:28) - PLID 41607 DDX_Control(pDX, IDC_RESULT_SCROLL_LEFT, m_btnResultScrollLeft); DDX_Control(pDX, IDC_RESULT_SCROLL_RIGHT, m_btnResultScrollRight); DDX_Control(pDX, IDC_LABNOTES, m_btnNotes); DDX_Control(pDX, IDC_ADDLABNOTE, m_btnAddNote); DDX_Control(pDX, IDC_LAB_ORDER_STATUS_LABEL, m_nxsOrderStatusLabel); DDX_Control(pDX, IDC_EDIT_ORDER_STATUS, m_btnEditOrderStatus); DDX_Control(pDX, IDC_ANATAOMICAL_LOCATION_TEXT_DISCRETE, m_nxstaticAnatomicalLocationTextDiscrete); DDX_Control(pDX, IDC_ANATAOMICAL_LOCATION_TEXT_REPORT, m_nxstaticAnatomicalLocationTextReport); DDX_Control(pDX, IDC_PT_EDUCATION_LABEL, m_nxlabelPatientEducation); DDX_Control(pDX, IDC_BTN_PT_EDUCATION, m_btnPatientEducation); } BEGIN_MESSAGE_MAP(CLabResultsTabDlg, CNxDialog) ON_BN_CLICKED(IDC_BTN_ADD_DIAGNOSIS, &CLabResultsTabDlg::OnAddDiagnosis) ON_BN_CLICKED(IDC_EDIT_FLAG, &CLabResultsTabDlg::OnEditFlag) ON_BN_CLICKED(IDC_EDIT_LAB_DIAGNOSES, &CLabResultsTabDlg::OnEditLabDiagnoses) ON_BN_CLICKED(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST, &CLabResultsTabDlg::OnEditClinicalDiagnosisList) ON_WM_SETCURSOR() ON_MESSAGE(NXM_NXLABEL_LBUTTONDOWN, &CLabResultsTabDlg::OnLabelClick) ON_BN_CLICKED(IDC_ADD_RESULT, &CLabResultsTabDlg::OnAddResult) ON_BN_CLICKED(IDC_DELETE_RESULT, &CLabResultsTabDlg::OnDeleteResult) ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATE_RECEIVED, &CLabResultsTabDlg::OnDateTimeChangedDateReceived) ON_BN_CLICKED(IDC_ATTACH_FILE, &CLabResultsTabDlg::OnAttachFile) ON_BN_CLICKED(IDC_DETACH_FILE, &CLabResultsTabDlg::OnDetachFile) ON_BN_CLICKED(IDC_EDIT_RESULT_STATUS, &CLabResultsTabDlg::OnEditResultStatus) ON_WM_TIMER() ON_BN_CLICKED(IDC_ZOOM, &CLabResultsTabDlg::OnZoom) ON_WM_SIZE() ON_BN_CLICKED(IDC_PDFVIEW_RADIO, &CLabResultsTabDlg::OnBnClickedPdfviewRadio) ON_BN_CLICKED(IDC_REPORTVIEW_RADIO, &CLabResultsTabDlg::OnBnClickedReportviewRadio) ON_BN_CLICKED(IDC_DISCRETEVALUES_RADIO, &CLabResultsTabDlg::OnBnClickedDiscretevaluesRadio) ON_BN_CLICKED(IDC_LAB_MARK_COMPLETED, &CLabResultsTabDlg::OnLabMarkCompleted) ON_BN_CLICKED(IDC_LAB_SIGNATURE, OnSignature) ON_BN_CLICKED(IDC_LAB_ACKNOWLEDGE, OnAcknowledgeResult) ON_BN_CLICKED(IDC_SCROLL_LEFT, &CLabResultsTabDlg::OnBnClickedScrollLeft) ON_BN_CLICKED(IDC_SCROLL_RIGHT, &CLabResultsTabDlg::OnBnClickedScrollRight) ON_BN_CLICKED(IDC_RESULT_SCROLL_LEFT, OnBnClickedResultScrollLeft) ON_BN_CLICKED(IDC_RESULT_SCROLL_RIGHT, OnBnClickedResultScrollRight) ON_BN_CLICKED(IDC_LABNOTES, &CLabResultsTabDlg::OnViewNotes) ON_BN_CLICKED(IDC_ADDLABNOTE, &CLabResultsTabDlg::OnAddNote) ON_BN_CLICKED(IDC_EDIT_ORDER_STATUS, &CLabResultsTabDlg::OnEditOrderStatus) ON_WM_DESTROY() ON_BN_CLICKED(IDC_CONFIGURE_REPORT_VIEW, &CLabResultsTabDlg::OnConfigureReportView) ON_BN_CLICKED(IDC_LAB_MARK_ALL_COMPLETE, &CLabResultsTabDlg::OnBnClickedLabMarkAllComplete) // (j.luckoski 2013-03-21 10:48) - PLID 55424 ON_BN_CLICKED(IDC_LAB_ACKNOWLEDGEANDSIGN, &CLabResultsTabDlg::OnBnClickedLabAcknowledgeandsign)// (f.gelderloos 2013-08-26 11:20) - PLID 57826 ON_WM_SHOWWINDOW() ON_BN_CLICKED(IDC_BTN_PT_EDUCATION, &CLabResultsTabDlg::OnBtnPtEducation) END_MESSAGE_MAP() // CLabResultsTabDlg message handlers void CLabResultsTabDlg::SetPatientID(long nPatientID) { m_nPatientID = nPatientID; } //TES 11/30/2009 - PLID 36452 - We now set just the initial lab ID, as this tab may have multiple labs on it. void CLabResultsTabDlg::SetInitialLabID(long nLabID) { m_nInitialLabID = nLabID; } void CLabResultsTabDlg::SetLabProcedureID(long nLabProcedureID) { m_nLabProcedureID = nLabProcedureID; } void CLabResultsTabDlg::SetLabProcedureType(LabType ltType) { m_ltType = ltType; } // (c.haag 2011-12-28) - PLID 41618 - This function is used for quick sorting the attached file list. // When finished, the array should be in order of attach date ascending. int CompareAttachedLabFile(const void *a, const void *b) { CAttachedLabFile* pa = (CAttachedLabFile*)a; CAttachedLabFile* pb = (CAttachedLabFile*)b; if (pa->dtAttached > pb->dtAttached) { return 1; } else if (pa->dtAttached < pb->dtAttached) { return -1; } else { return 0; } } // (r.gonet 06/12/2014) - PLID 40426 - Clears the m_mapResults map. void CLabResultsTabDlg::ClearResultsMap() { POSITION pos = m_mapResults.GetStartPosition(); stResults *pRes; long nKey; while (pos != NULL) { m_mapResults.GetNextAssoc(pos, nKey, pRes); delete pRes; m_mapResults.RemoveKey(nKey); } } // (r.gonet 06/12/2014) - PLID 40426 - Clears the m_mapAttachedFiles map. void CLabResultsTabDlg::ClearAttachedFilesMap() { POSITION pos = m_mapAttachedFiles.GetStartPosition(); CMap<LPDISPATCH, LPDISPATCH, CString, CString&> *pMap = NULL; LPDISPATCH pKey; while (pos != NULL) { m_mapAttachedFiles.GetNextAssoc(pos, pKey, pMap); delete pMap; m_mapAttachedFiles.RemoveKey(pKey); } } //TES 11/20/2009 - PLID 36191 - Loads an existing lab (SetLabID() should have been called before this function). void CLabResultsTabDlg::LoadExisting() { //TES 11/22/2009 - PLID 36191 - Load all the results into our tree. m_pResultsTree->Clear(); // (r.gonet 06/12/2014) - PLID 40426 - Free the memory used by both maps. ClearResultsMap(); ClearAttachedFilesMap(); //TES 11/30/2009 - PLID 36452 - We now load all labs that have the same form number (and patient ID, just in case) as the "initial" // lab that we were given. // (a.walling 2010-01-18 10:17) - PLID 36936 - LOINC code // (a.walling 2010-02-25 15:49) - PLID 37546 - Date Performed // (z.manning 2010-05-12 10:30) - PLID 37400 - HL7 Message ID // (c.haag 2010-11-18 13:31) - PLID 37372 - Added signature fields // (c.haag 2010-12-02 10:28) - PLID 41590 - Added completed fields // (c.haag 2010-01-27) - PLID 41618 - Added attachdate //TES 4/28/2011 - PLID 43426 - Added DateReceivedByLab //TES 5/2/2011 - PLID 43428 - Added OrderStatusID //TES 8/5/2011 - PLID 44901 - Filter on permissioned locations //TES 8/6/2013 - PLID 51147 - Added FlagTodoPriority // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. Added specimen data // (d.singleton 2013-07-16 17:28) - PLID 57600 - show CollectionStartTime and CollectionEndTime in the html view of lab results // (d.singleton 2013-08-07 16:04) - PLID 57912 - need to show the Performing Provider on report view of labresult tab dlg // (d.singleton 2013-10-25 12:28) - PLID 59181 - need new option to pull performing lab from obx23 and show on the html view //TES 9/10/2013 - PLID 58511 - Added LabWasReplaced and ResultWasReplaced //TES 11/5/2013 - PLID 59320 - Updated the ResultWasReplaced calculation, it now includes results that were replaced as part of a lab being replaced // (d.singleton 2013-11-26 10:20) - PLID 59379 - need to expand the funtionality of reflex tests to match on filler order number and other results of the same hl7 message file _RecordsetPtr rs = CreateParamRecordset("SELECT LabsT.ID AS LabID, LabsT.FormNumberTextID, LabsT.Specimen, " "LabResultsT.ResultID, LabResultsT.Name, DateReceived, SlideTextID, DiagnosisDesc, " "ClinicalDiagnosisDesc, FlagID, LabResultFlagsT.Name AS Flag, LabResultsT.Value, Reference, LabResultsT.MailID, MailSent.PathName, " "StatusID, LabResultStatusT.Description AS Status, Comments, Units, AcknowledgedUserID, AcknowledgedDate, " "LabResultsT.ResultCompletedDate, LabResultsT.ResultCompletedBy, CompletedUser.UserName AS ResultCompletedByUsername, " "LabResultsT.ResultSignatureImageFile, LabResultsT.ResultSignatureInkData, LabResultsT.ResultSignatureTextData, " "UsersT.UserName AS AcknowledgedByUser, LabResultsT.LOINC, LabResultsT.DatePerformed, LabResultsT.HL7MessageID, " "LabResultsT.ResultSignedDate, LabResultsT.ResultSignedBy, SignedUser.UserName AS ResultSignedByUsername, " "MailSent.Date AS AttachDate, LabResultsT.DateReceivedByLab, LabsT.OrderStatusID, LabResultFlagsT.TodoPriority AS FlagTodoPriority, " "LabsT.SPecimenID, LabsT.SpecimenIdText, LabsT.SpecimenStartTime, LabsT.SpecimenEndTime, LabsT.SpecimenRejectReason, LabsT.SpecimenCondition, " "LabsT.ServiceStartTime, LabsT.ServiceEndTime, LabResultsT.PerformingProvider, LabResultsT.PerformingLabID, LocationsT.Name AS PerformingLabName, " "LocationsT.Address1 AS PerformingLabAddress, LocationsT.City AS PerformingLabCity, LocationsT.State AS PerformingLabState, " "LocationsT.Zip AS PerformingLabZip, LocationsT.Country AS PerformingLabCountry, LocationsT.ParishCode AS PerformingLabParish, LabResultsT.ObservationDate, " "convert(bit, CASE WHEN LinkedLabsQ.LinkedLabID Is Null THEN 0 ELSE 1 END) AS LabWasReplaced, " "convert(bit, CASE WHEN LinkedResultsQ.LinkedResultID Is Null THEN CASE WHEN LabResultsT.HL7MessageID NOT IN (SELECT HL7MessageID FROM LabResultsT WHERE LinkedLabID Is Not Null) AND LinkedLabsQ.LinkedLabID Is Not Null THEN 1 ELSE 0 END ELSE 1 END) AS ResultWasReplaced " "FROM LabsT INNER JOIN (SELECT * FROM LabsT WHERE ID = {INT}) AS RequestedLab " "ON LabsT.FormNumberTextID = RequestedLab.FormNumberTextID AND LabsT.PatientID = RequestedLab.PatientID " //(e.lally 2010-04-07) PLID 37374 - Remove the deleted results from the join, instead of removing the whole lab req. record "LEFT JOIN LabResultsT ON (LabsT.ID = LabResultsT.LabID OR LabsT.ParentResultID = LabResultsT.ResultID) AND LabResultsT.Deleted = 0 " "LEFT JOIN UsersT AS CompletedUser ON LabResultsT.ResultCompletedBy = CompletedUser.PersonID " "LEFT JOIN UsersT AS SignedUser ON LabResultsT.ResultSignedBy = SignedUser.PersonID " "LEFT JOIN LabResultFlagsT ON LabResultsT.FlagID = LabResultFlagsT.ID " "LEFT JOIN MailSent ON LabResultsT.MailID = MailSent.MailID " "LEFT JOIN LabResultStatusT ON LabResultsT.StatusID = LabResultStatusT.ID " "LEFT JOIN UsersT ON LabResultsT.AcknowledgedUserID = UsersT.PersonID " "LEFT JOIN (SELECT LinkedLabID FROM LabResultsT WHERE Deleted = 0 GROUP BY LinkedLabID) LinkedLabsQ ON LabsT.ID = LinkedLabsQ.LinkedLabID " "LEFT JOIN (SELECT LinkedResultID FROM LabResultsT WHERE Deleted = 0 GROUP BY LinkedResultID) LinkedResultsQ ON LabResultsT.ResultID = LinkedResultsQ.LinkedResultID " "LEFT JOIN LocationsT ON LabResultsT.PerformingLabID = LocationsT.ID " "WHERE LabsT.Deleted = 0 " "AND {SQLFRAGMENT} " //(e.lally 2010-04-07) PLID 37374 - Remove the deleted results from the join, instead of removing the whole lab req. record, //otherwise we can't add new results to a req. that had all of its previous results deleted. //"AND COALESCE(LabResultsT.Deleted,0) = 0 " // (d.singleton 2012-08-20 16:20) - PLID 42596 put in an order by on Specimen to make the results populate alphabetically. "ORDER BY LabsT.Specimen, LabsT.BiopsyDate DESC, LabsT.ID DESC, LabResultsT.DateReceived DESC", m_nInitialLabID, GetAllowedLocationClause_Param("LabsT.LocationID")); //TES 11/30/2009 - PLID 36452 - Our top level rows are now for labs, so track the current lab so we can tell when to make a new parent. long nCurrentLabID = -1; IRowSettingsPtr pLabRow = NULL; //We want all dates to default to an invalid date COleDateTime dtDefault = COleDateTime(0.00); dtDefault.SetStatus(COleDateTime::invalid); //TES 5/2/2011 - PLID 43428 - The Order Status will be the same for all rows, so only check it once bool bLoadedOrderStatus = false; while(!rs->eof) { //TES 11/30/2009 - PLID 36452 - First, is this a new lab? long nLabID = AdoFldLong(rs, "LabID"); if(nLabID != nCurrentLabID) { //TES 11/30/2009 - PLID 36452 - It is, let's make a new parent row. nCurrentLabID = nLabID; CString strLabName = AdoFldString(rs, "FormNumberTextID",""); CString strSpecimen = AdoFldString(rs, "Specimen",""); if(!strSpecimen.IsEmpty()) { strLabName += " - " + strSpecimen; } pLabRow = GetNewResultsTreeRow(); pLabRow->PutValue(lrtcResultID, g_cvarNull); pLabRow->PutValue(lrtcFieldID, (long)lrfLabName); pLabRow->PutValue(lrtcFieldName, _bstr_t("Form #")); pLabRow->PutValue(lrtcValue, _bstr_t(strLabName)); pLabRow->PutValue(lrtcForeignKeyID, nLabID); pLabRow->PutValue(lrtcSpecimen, _bstr_t(strSpecimen)); pLabRow->PutValue(lrtcHL7MessageID, g_cvarNull); // (b.spivey, April 09, 2013) - PLID 44387 - Assume false until we can find out otherwise. pLabRow->PutValue(lrtcLoadedAsIncomplete, g_cvarFalse); //TES 9/10/2013 - PLID 58511 - Fill lrtcExtraValue with a flag for whether this lab has been replaced by a subsequent one pLabRow->PutValue(lrtcExtraValue, AdoFldBool(rs, "LabWasReplaced", FALSE)?g_cvarTrue:g_cvarFalse); // (d.singleton 2013-10-25 16:20) - PLID 59197 - need to move the specimen segment values to its own header in the html view for labs, so it will show regardless of any results. pLabRow->PutValue(lrtcSpecimenIDText, rs->Fields->Item["SpecimenIDText"]->Value); pLabRow->PutValue(lrtcSpecimenCollectionStartTime, rs->Fields->Item["SpecimenStartTime"]->Value); pLabRow->PutValue(lrtcSpecimenCollectionEndTime, rs->Fields->Item["SpecimenEndTime"]->Value); pLabRow->PutValue(lrtcSpecimenRejectReason, rs->Fields->Item["SpecimenRejectReason"]->Value); pLabRow->PutValue(lrtcSpecimenCondition, rs->Fields->Item["SpecimenCondition"]->Value); m_pResultsTree->AddRowAtEnd(pLabRow, NULL); } //TES 5/2/2011 - PLID 43428 - Pull the order status, if we haven't yet. if(!bLoadedOrderStatus) { IRowSettingsPtr pStatusRow = m_pOrderStatusCombo->SetSelByColumn(oscID, rs->Fields->Item["OrderStatusID"]->GetValue()); if(pStatusRow) { m_strSavedOrderStatus = VarString(pStatusRow->GetValue(oscDescription)); } else { m_strSavedOrderStatus = "<None>"; } bLoadedOrderStatus = true; } long nResultID = AdoFldLong(rs, "ResultID", -1); if(nResultID != -1) { //TES 11/22/2009 - PLID 36191 - Track the results as we go, for auditing purposes. stResults *pstRes = new stResults; pstRes->nResultID = nResultID; IRowSettingsPtr pParentRow = GetNewResultsTreeRow(); //TES 11/22/2009 - PLID 36191 - First, add the parent row, which is also the Name field. pParentRow->PutValue(lrtcResultID, nResultID); pParentRow->PutValue(lrtcFieldID, (long)lrfName); pParentRow->PutValue(lrtcFieldName, _bstr_t("Name")); _variant_t var = rs->Fields->GetItem("Name")->Value; pParentRow->PutValue(lrtcValue, var); pstRes->strResultName = VarString(var,""); pParentRow->PutValue(lrtcForeignKeyID, g_cvarNull); // (z.manning 2010-05-12 10:37) - PLID 37400 - Added HL7 message ID pParentRow->PutValue(lrtcHL7MessageID, rs->GetFields()->GetItem("HL7MessageID")->GetValue()); // (c.haag 2010-11-18 13:45) - PLID 37372 - Added columns for per-result signature info. pParentRow->PutValue(lrtcSignatureImageFile, _bstr_t(AdoFldString(rs->GetFields(), "ResultSignatureImageFile", ""))); pParentRow->PutValue(lrtcSignatureInkData, rs->GetFields()->GetItem("ResultSignatureInkData")->Value); // (j.jones 2010-04-12 17:29) - PLID 38166 - added a date/timestamp pParentRow->PutValue(lrtcSignatureTextData, rs->GetFields()->GetItem("ResultSignatureTextData")->Value); // (c.haag 2010-11-23 10:50) - PLID 37372 - Signed By fields pParentRow->PutValue(lrtcSignedBy, AdoFldLong(rs, "ResultSignedBy", -1)); pParentRow->PutValue(lrtcSignedUsername, _bstr_t(AdoFldString(rs, "ResultSignedByUsername", ""))); COleDateTime dtSigned = AdoFldDateTime(rs, "ResultSignedDate", dtDefault); if (COleDateTime::valid == dtSigned.GetStatus()) { pParentRow->PutValue(lrtcSignedDate, _variant_t(dtSigned, VT_DATE)); } else { pParentRow->PutValue(lrtcSignedDate, g_cvarNull); } pParentRow->PutValue(lrtcSavedSignedBy, pParentRow->GetValue(lrtcSignedBy)); pParentRow->PutValue(lrtcSavedSignedDate, pParentRow->GetValue(lrtcSignedDate)); // (c.haag 2010-12-02 10:28) - PLID 41590 - Completed Date COleDateTime dtCompleted = AdoFldDateTime(rs, "ResultCompletedDate", dtDefault); if (COleDateTime::valid == dtCompleted.GetStatus()) { pParentRow->PutValue(lrtcCompletedDate, _variant_t(dtCompleted, VT_DATE)); } else { pParentRow->PutValue(lrtcCompletedDate, g_cvarNull); } // (c.haag 2010-12-02 10:28) - PLID 41590 - Completed By pParentRow->PutValue(lrtcCompletedBy, AdoFldLong(rs, "ResultCompletedBy", -1)); pParentRow->PutValue(lrtcCompletedUsername, _bstr_t(AdoFldString(rs, "ResultCompletedByUsername", ""))); pParentRow->PutValue(lrtcSavedCompletedBy, pParentRow->GetValue(lrtcCompletedBy)); pParentRow->PutValue(lrtcSavedCompletedDate, pParentRow->GetValue(lrtcCompletedDate)); //TES 9/10/2013 - PLID 58511 - Fill lrtcExtraValue with a flag indicating whether this result has been replaced by another one pParentRow->PutValue(lrtcExtraValue, AdoFldBool(rs, "ResultWasReplaced", FALSE)?g_cvarTrue:g_cvarFalse); //TES 11/22/2009 - PLID 36191 - Add it at the end. //TES 11/30/2009 - PLID 36452 - Add it as a child of the Lab row. m_pResultsTree->AddRowAtEnd(pParentRow, pLabRow); //TES 4/28/2011 - PLID 43426 - Date Received By Lab IRowSettingsPtr pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfDateReceivedByLab); pRow->PutValue(lrtcFieldName, _bstr_t("Date Rec'd (Lab)")); var = rs->Fields->GetItem("DateReceivedByLab")->Value; pRow->PutValue(lrtcValue, var); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtReceivedByLab.SetStatus(COleDateTime::null); } else { pstRes->dtReceivedByLab = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Now add each of the other fields as child rows. //TES 11/22/2009 - PLID 36191 - Date Received pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfDateReceived); pRow->PutValue(lrtcFieldName, _bstr_t("Date Rec'd")); var = rs->Fields->GetItem("DateReceived")->Value; pRow->PutValue(lrtcValue, var); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(var.vt == VT_NULL) { pRow->PutVisible(VARIANT_FALSE); //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pstRes->dtReceivedDate.SetStatus(COleDateTime::invalid); } else if (var.vt == VT_DATE) { COleDateTime dt = VarDateTime(var); if (dt.GetStatus() == COleDateTime::valid) { //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pstRes->dtReceivedDate = dt; } else { //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pstRes->dtReceivedDate.SetStatus(COleDateTime::invalid); } } else if (var.vt == VT_BSTR) { if (VarString(var).IsEmpty()) { //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pstRes->dtReceivedDate.SetStatus(COleDateTime::invalid); } else { COleDateTime dt; dt.ParseDateTime(VarString(var)); if (dt.GetStatus() == COleDateTime::valid) { //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pstRes->dtReceivedDate = dt; } else { //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pstRes->dtReceivedDate.SetStatus(COleDateTime::invalid); } } } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (a.walling 2010-02-25 15:46) - PLID 37546 - Date performed pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfDatePerformed); pRow->PutValue(lrtcFieldName, _bstr_t("Date Perf'd")); var = rs->Fields->GetItem("DatePerformed")->Value; pRow->PutValue(lrtcValue, var); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtPerformedDate.SetStatus(COleDateTime::null); } else { pstRes->dtPerformedDate = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (a.walling 2010-01-18 10:17) - PLID 36936 - LOINC code pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfLOINC); pRow->PutValue(lrtcFieldName, _bstr_t("LOINC")); var = rs->Fields->GetItem("LOINC")->Value; pRow->PutValue(lrtcValue, var); pstRes->strLOINC = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); //TES 11/22/2009 - PLID 36191 - Slide # is hidden on non-biopsy labs if(VarString(var, "").IsEmpty()) { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Value pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfValue); pRow->PutValue(lrtcFieldName, _bstr_t("Value")); //TES 11/22/2009 - PLID 36191 - Do we have a MailID? var = rs->Fields->GetItem("MailID")->Value; if(var.vt == VT_I4) { //TES 11/22/2009 - PLID 36191 - Yes, so this is a document pRow->PutValue(lrtcValue, rs->Fields->GetItem("PathName")->Value); pRow->PutValue(lrtcForeignKeyID, var); pstRes->nMailID = VarLong(var); pstRes->strDocPath = VarString(rs->Fields->GetItem("PathName")->Value,""); // (c.haag 2010-01-27) - PLID 41618 - Attachment date. We require one; GetServerTime should never be called except for bad data _variant_t vAttachedDate = rs->Fields->GetItem("AttachDate")->Value; if (VT_NULL == vAttachedDate.vt) { vAttachedDate = _variant_t(GetServerTime(), VT_DATE); } pRow->PutValue(lrtcDate, vAttachedDate); //TES 11/23/2009 - PLID 36192 - Remember that this file is attached to this result. //TES 1/27/2010 - PLID 36862 - Moved to its own function SetAttachedFile(pParentRow, pstRes->strDocPath); } else { //TES 11/22/2009 - PLID 36191 - No, so this is just the value. var = rs->Fields->GetItem("Value")->Value; pstRes->strValue = VarString(var,""); pRow->PutValue(lrtcValue, var); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Slide # pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSlideNum); pRow->PutValue(lrtcFieldName, _bstr_t("Slide #")); var = rs->Fields->GetItem("SlideTextID")->Value; pRow->PutValue(lrtcValue, var); pstRes->strSlideNum = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); //TES 11/22/2009 - PLID 36191 - Slide # is hidden on non-biopsy labs if(m_ltType != ltBiopsy || VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Diagnosis pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfDiagnosis); pRow->PutValue(lrtcFieldName, _bstr_t("Diagnosis")); var = rs->Fields->GetItem("DiagnosisDesc")->Value; pRow->PutValue(lrtcValue, var); pstRes->strDiagnosis = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Microscopic Description pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfMicroscopicDescription); //TES 12/4/2009 - PLID 36191 - The newline is intentional; this is a data width column now. pRow->PutValue(lrtcFieldName, _bstr_t("Microscopic\r\nDesc.")); var = rs->Fields->GetItem("ClinicalDiagnosisDesc")->Value; pRow->PutValue(lrtcValue, var); pstRes->strMicroDesc = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); //TES 11/22/2009 - PLID 36191 - Microscopic Description is hidden on non-biopsy labs if(m_ltType != ltBiopsy || VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Flag pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfFlag); pRow->PutValue(lrtcFieldName, _bstr_t("Flag")); var = rs->Fields->GetItem("FlagID")->Value; pstRes->nFlagID = VarLong(var,-1); _variant_t var2 = rs->Fields->GetItem("Flag")->Value; pRow->PutValue(lrtcValue, var2); pstRes->strFlag = VarString(var2,""); pRow->PutValue(lrtcForeignKeyID, var); if(var.vt == VT_NULL) { pRow->PutVisible(VARIANT_FALSE); } //TES 8/6/2013 - PLID 51147 - Store the TodoPriority in the tree var = rs->Fields->GetItem("FlagTodoPriority")->Value; pRow->PutValue(lrtcExtraValue, var); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Status pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfStatus); pRow->PutValue(lrtcFieldName, _bstr_t("Status")); var = rs->Fields->GetItem("StatusID")->Value; pstRes->nStatusID = VarLong(var,-1); var2 = rs->Fields->GetItem("Status")->Value; pRow->PutValue(lrtcValue, var2); pstRes->strStatus = VarString(var2,""); pRow->PutValue(lrtcForeignKeyID, var); if(var.vt == VT_NULL) { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Reference pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfReference); pRow->PutValue(lrtcFieldName, _bstr_t("Reference")); var = rs->Fields->GetItem("Reference")->Value; pRow->PutValue(lrtcValue, var); pstRes->strReference = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Units pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfUnits); pRow->PutValue(lrtcFieldName, _bstr_t("Units")); var = rs->Fields->GetItem("Units")->Value; pRow->PutValue(lrtcValue, var); pstRes->strUnits = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Comments pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfComments); pRow->PutValue(lrtcFieldName, _bstr_t("Comments")); var = rs->Fields->GetItem("Comments")->Value; pRow->PutValue(lrtcValue, var); pstRes->strComments = VarString(var,""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Acknowledged By pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfAcknowledgedBy); //TES 12/5/2009 - PLID 36191 - Since this row will alwasy be hidden, and the field name row is Data width now, // I abbreviated this description. pRow->PutValue(lrtcFieldName, _bstr_t("Ack. By")); var = rs->Fields->GetItem("AcknowledgedUserID")->Value; pRow->PutValue(lrtcForeignKeyID, var); pstRes->nAcknowledgedUserID = VarLong(var,-1); pRow->PutValue(lrtcValue, rs->Fields->GetItem("AcknowledgedByUser")->Value); //TES 11/22/2009 - PLID 36191 - We'll always hide this (consistent with old behavior. pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //TES 11/22/2009 - PLID 36191 - Acknowledged On pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfAcknowledgedOn); //TES 12/5/2009 - PLID 36191 - Since this row will alwasy be hidden, and the field name row is Data width now, // I abbreviated this description. pRow->PutValue(lrtcFieldName, _bstr_t("Ack. On")); var = rs->Fields->GetItem("AcknowledgedDate")->Value; pRow->PutValue(lrtcValue, var); COleDateTime dtInvalid; dtInvalid.SetStatus(COleDateTime::invalid); pstRes->dtAcknowledgedDate = VarDateTime(var,dtInvalid); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); //TES 11/22/2009 - PLID 36191 - We'll always hide this (consistent with old behavior). pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. add new specimen specific data from SPM segment pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenIdentifier); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Id")); var = rs->Fields->GetItem("SpecimenID")->Value; pRow->PutValue(lrtcValue, var); pstRes->strSpecimenID = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. add new specimen specific data from SPM segment pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenIdText); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen ID Text")); var = rs->Fields->GetItem("SpecimenIdText")->Value; pRow->PutValue(lrtcValue, var); pstRes->strSpecimenIdText = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. add new specimen specific data from SPM segment pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenStartTime); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Collection Start Time")); var = rs->Fields->GetItem("SpecimenStartTime")->Value; pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutValue(lrtcValue, var); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtSpecimenStartTime.SetStatus(COleDateTime::null); } else { pstRes->dtSpecimenStartTime = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. add new specimen specific data from SPM segment pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenEndTime); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Collection End Time")); var = rs->Fields->GetItem("SpecimenEndTime")->Value; pRow->PutValue(lrtcValue, var); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtSpecimenEndTime.SetStatus(COleDateTime::null); } else { pstRes->dtSpecimenEndTime = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. add new specimen specific data from SPM segment pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenRejectReason); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Reject Reason")); var = rs->Fields->GetItem("SpecimenRejectReason")->Value; pRow->PutValue(lrtcValue, var); pstRes->strRejectReason = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-06-20 14:33) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. add new specimen specific data from SPM segment pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenCondition); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Condition")); var = rs->Fields->GetItem("SpecimenCondition")->Value; pRow->PutValue(lrtcValue, var); pstRes->strCondition = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-16 17:30) - PLID 57600 - show CollectionStartTime and CollectionEndTime in the html view of lab results pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfServiceStartTime); pRow->PutValue(lrtcFieldName, _bstr_t("Lab Service Start Time")); var = rs->Fields->GetItem("ServiceStartTime")->Value; pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutValue(lrtcValue, var); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtServiceStartTime.SetStatus(COleDateTime::null); } else { pstRes->dtServiceStartTime = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-16 17:30) - PLID 57600 - show CollectionStartTime and CollectionEndTime in the html view of lab results pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfServiceEndTime); pRow->PutValue(lrtcFieldName, _bstr_t("Lab Service End Time")); var = rs->Fields->GetItem("ServiceEndTime")->Value; pRow->PutValue(lrtcValue, var); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtServiceEndTime.SetStatus(COleDateTime::null); } else { pstRes->dtServiceEndTime = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-08-07 16:08) - PLID 57912 - need to show the Performing Provider on report view of labresult tab dlg pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerformingProvider); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Provider")); var = rs->Fields->GetItem("PerformingProvider")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerformingProvider = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-10-25 13:51) - PLID 59181 - need new option to pull performing lab from obx23 and show on the html view pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerformingLab); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Name")); var = rs->Fields->GetItem("PerformingLabName")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerformingLab = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-04 17:01) - PLID 59294 - add observation date to the html view for lab results. pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfObservationDate); pRow->PutValue(lrtcFieldName, _bstr_t("Observation Date")); var = rs->Fields->GetItem("ObservationDate")->Value; pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutValue(lrtcValue, var); if(var.vt != VT_DATE) { pRow->PutVisible(VARIANT_FALSE); pstRes->dtObservationDate.SetStatus(COleDateTime::null); } else { pstRes->dtObservationDate = VarDateTime(var); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-27 12:27) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabAddress); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Address")); var = rs->Fields->GetItem("PerformingLabAddress")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerfLabAddress = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-27 12:27) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabCity); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab City")); var = rs->Fields->GetItem("PerformingLabCity")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerfLabCity = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-27 12:27) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabState); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab State")); var = rs->Fields->GetItem("PerformingLabState")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerfLabState = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-27 12:27) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabZip); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Zip")); var = rs->Fields->GetItem("PerformingLabZip")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerfLabZip = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-27 12:27) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabCountry); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Country")); var = rs->Fields->GetItem("PerformingLabCountry")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerfLabCountry = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-27 12:27) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, nResultID); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabParish); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Parish")); var = rs->Fields->GetItem("PerformingLabParish")->Value; pRow->PutValue(lrtcValue, var); pstRes->strPerfLabParish = VarString(var, ""); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); if(VarString(var,"") == "") { pRow->PutVisible(VARIANT_FALSE); } m_pResultsTree->AddRowAtEnd(pRow, pParentRow); pParentRow->PutExpanded(VARIANT_TRUE); m_mapResults.SetAt(nResultID, pstRes); //TES 12/7/2009 - PLID 36191 - Track which row this result is associated with. pstRes->pRow = pParentRow; } rs->MoveNext(); } //TES 11/30/2009 - PLID 36452 - Make sure all our labs are expanded pLabRow = m_pResultsTree->GetFirstRow(); while(pLabRow) { pLabRow->PutExpanded(VARIANT_TRUE); pLabRow = pLabRow->GetNextRow(); } /*//TES 11/22/2009 - PLID 36191 - Now select the first row. //TES 11/30/2009 - PLID 36452 - Select the first child of the first row, if any. pLabRow = m_pResultsTree->GetFirstRow(); if(pLabRow) { IRowSettingsPtr pFirstResultRow = pLabRow->GetFirstChildRow(); if(pFirstResultRow == NULL) { m_pResultsTree->CurSel = pLabRow; } else { m_pResultsTree->CurSel = pFirstResultRow; } } LoadResult(m_pResultsTree->CurSel);*/ // (c.haag 2010-12-29 09:30) - PLID 41618 - At this point in time, the attachments view is stilll empty, and all // the attachment information for all results have just been loaded into memory. The attachment view relies on this // information to determine what its default selection is, and now that the information has been loaded, it can do // that determination now. if (m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->SetDefaultSelection(); } else { ThrowNxException("m_pLabResultsAttachmentView was null when trying to initialize!"); } //TES 12/18/2009 - PLID 36665 - We don't want the first row, we want the row corresponding to our initial lab. SetCurrentLab(m_nInitialLabID); // (b.spivey, April 09, 2013) - PLID 44387 - Check for any labs that loaded as incomplete. CArray<long, long> aryLabIDs; GetAllLabIDsAry(aryLabIDs); for (int i = 0; i < aryLabIDs.GetCount(); i++) { if(!AllResultsAreCompleted(aryLabIDs.GetAt(i)) || !DoesLabHaveResults(aryLabIDs.GetAt(i))) { IRowSettingsPtr pRow = GetLabRowByID(aryLabIDs.GetAt(i)); pRow->PutValue(lrtcLoadedAsIncomplete, g_cvarTrue); } } } //TES 11/20/2009 - PLID 36191 - Loads a new lab. void CLabResultsTabDlg::LoadNew() { //TES 11/20/2009 - PLID 36191 - We don't really need to load anything here, since a new lab won't have any results. // Just clear everything out. //TES 11/30/2009 - PLID 36452 - Actually, just add a new lab AddNew(); } void CLabResultsTabDlg::AddNew() { //TES 11/30/2009 - PLID 36452 - Simply create a new top-level row, and add it. IRowSettingsPtr pLabRow = GetNewResultsTreeRow(); pLabRow->PutValue(lrtcResultID, g_cvarNull); pLabRow->PutValue(lrtcFieldID, (long)lrfLabName); pLabRow->PutValue(lrtcFieldName, _bstr_t("Form #")); pLabRow->PutValue(lrtcValue, _bstr_t(m_pLabEntryDlg->GetFormNumber())); pLabRow->PutValue(lrtcForeignKeyID, (long)-1); pLabRow->PutValue(lrtcSpecimen, _bstr_t("")); // (c.haag 2010-12-02 10:28) - PLID 38633 - Completed info pLabRow->PutValue(lrtcCompletedDate, g_cvarNull); pLabRow->PutValue(lrtcCompletedBy, (long)-1); pLabRow->PutValue(lrtcCompletedUsername, ""); pLabRow->PutValue(lrtcSavedCompletedBy, pLabRow->GetValue(lrtcCompletedBy)); pLabRow->PutValue(lrtcSavedCompletedDate, pLabRow->GetValue(lrtcCompletedDate)); //TES 9/10/2013 - PLID 58511 - Lab rows now check this field pLabRow->PutValue(lrtcExtraValue, g_cvarFalse); // (b.spivey, April 09, 2013) - PLID 44387 - Any new lab is considered incomplete automatically. pLabRow->PutValue(lrtcLoadedAsIncomplete, g_cvarTrue); // (j.gruber 2011-02-18 16:24) - PLID 41606 - add it at the top instead m_pResultsTree->AddRowBefore(pLabRow, m_pResultsTree->GetFirstRow()); pLabRow->PutExpanded(VARIANT_TRUE); m_pResultsTree->CurSel = pLabRow; LoadResult(pLabRow); // (j.dinatale 2010-12-14) - PLID 41438 - Only if the view hasnt been set yet, do we set the current view. // Also, the default view should be the pdf view, as per the preference's default. If we already set up the view, // set it again because of the z-order issue with the web browser active x control // (j.gruber 2010-12-08 13:37) - PLID 41662 if(m_nCurrentView == rvNotSet){ SetCurrentResultsView(GetRemotePropertyInt("LabResultUserView", (long)rvPDF, 0, GetCurrentUserName(), true)); }else{ SetCurrentResultsView(m_nCurrentView); } } extern CPracticeApp theApp; BOOL CLabResultsTabDlg::OnInitDialog() { CNxDialog::OnInitDialog(); try { // (a.walling 2011-06-22 11:59) - PLID 44260 - If we want to keep the DLL loaded, notify the MainFrame that we will be using it now. GetMainFrame()->HoldAdobeAcrobatReference(); m_btnAddDiagnosis.AutoSet(NXB_NEW); m_btnZoom.AutoSet(NXB_INSPECT); // (r.gonet 06/24/2014) - PLID 61685 - Removed the 255 character limit on the Result Comments box. if (NULL == (m_pLabResultsAttachmentView = new CLabResultsAttachmentView(*this))) { ThrowNxException("Could not initialize the result attachment view!"); } // (j.jones 2010-05-27 15:26) - PLID 38863 - you now need special permission to edit this field if(GetCurrentUserPermissions(bioPatientLabs) & sptDynamic2) { m_nxeditResultComments.SetReadOnly(FALSE); } else { m_nxeditResultComments.SetReadOnly(TRUE); } // (a.walling 2010-01-18 10:43) - PLID 36936 m_nxeditResultLOINC.SetLimitText(20); m_nxlabelLOINC.SetText("LOINC:"); m_nxlabelLOINC.SetType(dtsHyperlink); // (r.gonet 2014-01-27 15:29) - PLID 59339 - Init the preferences to show or hide the patient education related controls. bool bShowPatientEducationButton = (GetRemotePropertyInt("ShowPatientEducationButtons", 1, 0, GetCurrentUserName()) ? true : false); bool bShowPatientEducationLink = (GetRemotePropertyInt("ShowPatientEducationLinks", 0, 0, GetCurrentUserName()) ? true : false); // (j.jones 2013-10-18 09:46) - PLID 58979 - added infobutton abilities m_btnPatientEducation.SetIcon(IDI_INFO_ICON); m_nxlabelPatientEducation.SetText("Pat. Edu."); // (r.gonet 2014-01-27 10:21) - PLID 59339 - Have a preference to toggle patient education options off. if(!bShowPatientEducationButton) { // (r.gonet 2014-01-27 15:29) - PLID 59339 - Hide the patient education info button m_btnPatientEducation.ShowWindow(SW_HIDE); } if(bShowPatientEducationLink) { // (r.gonet 2014-01-27 15:29) - PLID 59339 - Show the patient education link m_nxlabelPatientEducation.SetType(dtsHyperlink); } else if(!bShowPatientEducationLink && bShowPatientEducationButton) { // (r.gonet 2014-01-27 15:29) - PLID 59339 - We just need the label as a description of the info button. m_nxlabelPatientEducation.SetType(dtsText); } else if(!bShowPatientEducationLink && !bShowPatientEducationButton) { // (r.gonet 2014-01-27 15:29) - PLID 59339 - We don't need the label as either a link or a description label, so hide it. m_nxlabelPatientEducation.ShowWindow(SW_HIDE); } m_pClinicalDiagOptionsList = BindNxDataList2Ctrl(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST); //TES 11/28/2008 - PLID 32191 m_pStatusCombo = BindNxDataList2Ctrl(IDC_LAB_STATUS); m_pFlagCombo = BindNxDataList2Ctrl(IDC_LAB_FLAG); //TES 5/2/2011 - PLID 43428 m_pOrderStatusCombo = BindNxDataList2Ctrl(IDC_LAB_ORDER_STATUS); m_pOrderStatusCombo->WaitForRequery(dlPatienceLevelWaitIndefinitely); IRowSettingsPtr pNoneRow = m_pOrderStatusCombo->GetNewRow(); pNoneRow->PutValue(oscID, (long)-1); pNoneRow->PutValue(oscDescription, _bstr_t("<None>")); pNoneRow->PutValue(oscHL7Flag, _bstr_t("")); m_pOrderStatusCombo->AddRowBefore(pNoneRow, m_pOrderStatusCombo->GetFirstRow()); m_btnAddResult.AutoSet(NXB_NEW); m_btnDeleteResult.AutoSet(NXB_DELETE); m_btnAttachDoc.AutoSet(NXB_MODIFY); m_btnDetachDoc.AutoSet(NXB_MODIFY); m_markAllCompleteBtn.AutoSet(NXB_MODIFY); // (j.luckoski 3-21-13) PLID 55424 - Set color to new button m_AcknowledgeAndSignBtn.SetTextColor(RGB(0,0,0));// (f.gelderloos 2013-08-26 10:57) - PLID 57826 // (j.gruber 2010-11-24 11:27) - PLID 41607 - scroll buttons m_btnScrollLeft.AutoSet(NXB_LEFT); m_btnScrollRight.AutoSet(NXB_RIGHT); // (c.haag 2010-12-06 13:48) - PLID 41618 - Result scroll buttons m_btnResultScrollLeft.AutoSet(NXB_LEFT); m_btnResultScrollRight.AutoSet(NXB_RIGHT); m_nxlDocPath.SetColor(0x00FFB9A8); m_nxlDocPath.SetText(""); m_nxlDocPath.SetType(dtsHyperlink); //TES 12/14/2009 - PLID 36585 - Make a couple of the labels bold. m_nxstaticLabResultLabel.SetFont(theApp.GetPracticeFont(CPracticeApp::pftGeneralBold)); m_nxstaticAttachedFileLabel.SetFont(theApp.GetPracticeFont(CPracticeApp::pftGeneralBold)); m_pResultsTree = BindNxDataList2Ctrl(IDC_RESULTS_TREE, false); //TES 11/23/2009 - PLID 36192 - Initialize our web browswer for previewing attached files. m_pBrowser = GetDlgItem(IDC_PDF_PREVIEW)->GetControlUnknown(); //TES 11/23/2009 - PLID 36192 - Now set it to blank, and disable it. COleVariant varUrl("about:blank"); if (m_pBrowser) { m_pBrowser->put_RegisterAsDropTarget(VARIANT_FALSE); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(FALSE); } //TES 2/3/2010 - PLID 37191 - Remember that we're not previewing anything. m_strCurrentFileName = ""; //TES 2/3/2010 - PLID 37191 - Also disable the "Zoom" button. UpdateZoomButton(); // (j.dinatale 2010-12-27) - PLID 41591 - more preferences need to be cached. Specifically the Lab notes location // when in pdf and the default note category // (j.dinatale 2010-12-13) - PLID 41438 - Bulk Cache properties // (j.dinatale 2011-01-31) - PLID 41438 - make sure username is formatted properly // (r.gonet 03/07/2013) - PLID 43599 - Bulk cache the property for stripping extra whitespace. // (r.gonet 03/07/2013) - PLID 44465 - Bulk cache the property for font type. g_propManager.BulkCache("LabEntryDlg", propbitNumber, "(Username = '<None>' OR Username = '%s') AND Name IN (" "'LabAttachmentsDefaultCategory', " "'Labs_PromptForCommonMicroscopic', " "'SignatureCheckPasswordLab', " "'LabResultUserView', " "'LabNotesLevelPDFView', " "'LabNotesDefaultCategory', " "'SignAndAcknowledgeResultsForAllSpecimens', " "'LabReportViewFontType', " "'LabReportViewTrimExtraSpaces'" ")", _Q(GetCurrentUserName())); // (j.dinatale 2010-12-14) - PLID 41438 m_nCurrentView = rvNotSet; // (j.dinatale 2010-12-22) - PLID 41591 - set the icon to be the regular note icon by default m_btnNotes.AutoSet(NXB_NOTES); // (j.dinatale 2010-12-23) - PLID 41591 - set the icon of the add note button to be a plus icon m_btnAddNote.AutoSet(NXB_NEW); }NxCatchAll("Error in CLabResultsTabDlg::OnInitDialog()"); return TRUE; } //TES 11/20/2009 - PLID 36191 - Call to handle any processing that should take place after loading a lab record. void CLabResultsTabDlg::PostLoad() { //TES 11/22/2009 - PLID 36191 - We don't actually need to do anything here, showing/hiding fields is handled by LoadResult(). // (j.dinatale 2010-12-14) - PLID 41438 - not sure why this was here, but it was causing some trouble. // (k.messina 2011-11-16) - PLID 41438 - setting the default view to NexTech's report //SetCurrentResultsView(GetRemotePropertyInt("LabResultUserView", (long)rvNexTechReport, 0, GetCurrentUserName(), true)); } // (b.spivey, August 28, 2013) - PLID 46295 - This should get called after the tab is opened, so we're // gonna make sure the values in these text controls are ensured. void CLabResultsTabDlg::EnsureData() { CString strVal = GetAnatomicalLocationAsString(GetCurrentLab()); m_nxstaticAnatomicalLocationTextDiscrete.SetWindowTextA(strVal); m_nxstaticAnatomicalLocationTextReport.SetWindowTextA(strVal); } //TES 11/20/2009 - PLID 36191 - Saves and audits all results. //TES 10/31/2013 - PLID 59251 - Added arNewCDSInterventions, any interventions triggered in this function will be added to it void CLabResultsTabDlg::Save(long nNewLabID, long &nAuditTransactionID, BOOL &bSpawnToDo, IN OUT CDWordArray &arNewCDSInterventions) { CString strSql; bSpawnToDo = FALSE; CString strPersonName = GetExistingPatientName(m_nPatientID); // (j.gruber 2010-02-24 10:01) - PLID 37510 - need array for new/saved results CDWordArray dwaryResultIDs; //find what resultID we are at in case we have any additions AddStatementToSqlBatch(strSql, "SET NOCOUNT ON \r\n"); //AddDeclarationToSqlBatch(strSql, " DECLARE @nStartResultID INT; \r\n"); //AddDeclarationToSqlBatch(strSql, " SET @nStartResultID = (SELECT COALESCE(Max(ResultID), 0)+1 FROM LabResultsT) \r\n"); AddStatementToSqlBatch(strSql, "DECLARE @TempLabInsertsT TABLE ( \r\n" " ID int, ArrayIndex INT )"); //now do any detaches of documents for (int k=0; k < m_aryDetachedDocs.GetSize(); k++) { AddStatementToSqlBatch(strSql, "UPDATE LabResultsT SET MailID = NULL WHERE ResultID = %li ", m_aryDetachedDocs.GetAt(k)); } //now see if there are any deletions for (int i = 0; i < m_aryDeleteResults.GetSize(); i++) { long nResultID = m_aryDeleteResults.GetAt(i); AddStatementToSqlBatch(strSql, " UPDATE LabResultsT SET DELETED = 1, DeleteDate = GetDate(), DeletedBy = %li WHERE ResultID = %li; \r\n", GetCurrentUserID(), nResultID); if (nAuditTransactionID == -1) { nAuditTransactionID = BeginAuditTransaction(); } stResults *pDeletedRes; CString strAuditString; if (m_mapResults.Lookup(nResultID, pDeletedRes) ) { strAuditString = "Name: " + pDeletedRes->strResultName + ";"; //TES 4/28/2011 - PLID 43426 - Date Received By Lab if(pDeletedRes->dtReceivedByLab.GetStatus() == COleDateTime::valid) { CString strDate = FormatDateTimeForInterface(pDeletedRes->dtReceivedByLab, NULL, dtoDate); strAuditString += "Date Received By Lab: " + strDate + ";"; } else { strAuditString += "Date Received By Lab: ;"; } //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. if (pDeletedRes->dtReceivedDate.GetStatus() == COleDateTime::valid) { CString strDate = FormatDateTimeForInterface(pDeletedRes->dtReceivedDate, NULL, dtoDate); strAuditString += "Date Received: " + strDate + ";"; } else { strAuditString += "Date Received: ;"; } // (a.walling 2010-02-25 15:52) - PLID 37546 if (pDeletedRes->dtPerformedDate.GetStatus() == COleDateTime::valid) { strAuditString += "Date Performed: " + FormatDateTimeForInterface(pDeletedRes->dtPerformedDate, NULL, dtoDate) + ";"; } else { strAuditString += "Date Performed: ;"; } // (a.walling 2010-01-18 10:52) - PLID 36936 strAuditString += "LOINC: " + pDeletedRes->strLOINC + ";"; strAuditString += "Slide: " + pDeletedRes->strSlideNum + ";"; strAuditString += "Diagnosis: " + pDeletedRes->strDiagnosis + ";"; strAuditString += "Microscopic Desc: " + pDeletedRes->strMicroDesc + ";"; strAuditString += "Flag: " + pDeletedRes->strFlag + ";"; strAuditString += "Value: " + pDeletedRes->strValue + ";"; // (c.haag 2009-05-06 15:21) - PLID 33789 strAuditString += "Units: " + pDeletedRes->strUnits + ";"; strAuditString += "Reference: " + pDeletedRes->strReference + ";"; // (z.manning 2009-04-30 16:55) - PLID 28560 strAuditString += "Comments: " + pDeletedRes->strComments + ';'; // (c.haag 2009-05-07 14:35) - PLID 28561 if (pDeletedRes->nAcknowledgedUserID > -1) { strAuditString += "Acknowledged By: " + GetExistingUserName(pDeletedRes->nAcknowledgedUserID) + ";"; strAuditString += "Acknowledged Date: " + FormatDateTimeForInterface(pDeletedRes->dtAcknowledgedDate, DTF_STRIP_SECONDS, dtoDateTime); } } AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultDeleted, nResultID, strAuditString, "<Deleted>", aepHigh, aetDeleted); } //now add/update all the new items //TES 11/30/2009 - PLID 36452 - Loop through each lab. NXDATALIST2Lib::IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); CPtrArray aryNewRows; //TES 5/2/2011 - PLID 43428 - Grab the order status (it's the same for all labs). IRowSettingsPtr pOrderStatusRow = m_pOrderStatusCombo->CurSel; long nOrderStatusID = -1; CString strOrderStatus = "<None>"; if(pOrderStatusRow) { nOrderStatusID = pOrderStatusRow->GetValue(oscID); strOrderStatus = VarString(pOrderStatusRow->GetValue(oscDescription)); } // (b.spivey, March 19, 2013) - PLID 55943 - Array for lab IDs. CArray<long, long> aryLabIDs; while (pLabRow) { long nLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1); if(nLabID == -1) { //TES 11/30/2009 - PLID 36452 - This is our one and only new lab, update it with the new ID we've been given. nLabID = nNewLabID; pLabRow->PutValue(lrtcForeignKeyID, nNewLabID); } //TES 5/2/2011 - PLID 43428 - First, update the Order Status for this lab. AddStatementToSqlBatch(strSql, "UPDATE LabsT SET OrderStatusID = %s WHERE ID = %li", nOrderStatusID == -1 ? "NULL" : AsString(nOrderStatusID), nLabID); //TES 5/2/2011 - PLID 43428 - Now audit the order status if(strOrderStatus != m_strSavedOrderStatus) { if(nAuditTransactionID == -1) { nAuditTransactionID = BeginAuditTransaction(); } CString strFormNumberTextID = m_pLabEntryDlg->GetFormNumber(); IRowSettingsPtr pSpecRow = GetSpecFromCurrentRow(pLabRow); CString strSpecimen = VarString(pSpecRow->GetValue(lrtcSpecimen),""); CString strOld = strFormNumberTextID + " - " + strSpecimen + ": " + m_strSavedOrderStatus; CString strNew = strOrderStatus; AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiPatientLabOrderStatus, nLabID, strOld, strNew, aepMedium, aetChanged); //TES 5/2/2011 - PLID 43428 - We don't update the saved value here, we've changed the status for every specimen so we want // to audit for every specimen. } IRowSettingsPtr pParentRow = pLabRow->GetFirstChildRow(); while(pParentRow) { // (c.haag 2009-05-07 14:57) - PLID 28561 - Added acknowledged fields long nResultID, nFlagID, nMailID, nStatusID, nAcknowledgedUserID; // (c.haag 2009-05-06 14:48) - PLID 33789 - Added Units // (a.walling 2010-01-18 10:46) - PLID 36936 - Added LOINC CString strName, strReceivedDate, strSlideNum, strDiagnosis, strMicroDesc, strFlagID, strValue, strUnits, strReference, strFlagName, strDocPath, strMailID, strStatus, strStatusID, strResultComments, strAcknowledgedDate, strLOINC; //TES 12/1/2008 - PLID 32281 - Track the actual date received, not just a string representation of it. COleDateTime dtReceived, dtAcknowledgedDate; // (c.haag 2010-01-27) - PLID 41618 - Attached date COleDateTime dtAttached; //TES 8/6/2013 - PLID 51147 - Default the todo priority to the no-flag default, and track whether we've overridden it with a flag priority long nTodoPriority = GetRemotePropertyInt("Lab_DefaultTodoPriority", 1, 0, "<None>"); bool bFlagFound = false; // (a.walling 2010-02-25 15:55) - PLID 37546 - Added Date Performed // (a.walling 2010-02-25 15:59) - PLID 37546 - Actually, modification of date performed is on hold for now. //CString strPerformedDate; //COleDateTime dtPerformed; //TES 11/22/2009 - PLID 36191 - Pull the name out of our parent-level row. nResultID = VarLong(pParentRow->GetValue(lrtcResultID)); strName = VarString(pParentRow->GetValue(lrtcValue), ""); // (a.walling 2010-01-18 10:46) - PLID 36936 _variant_t varLOINC = GetTreeValue(pParentRow, lrfLOINC, lrtcValue); if (varLOINC.vt == VT_BSTR) { strLOINC = VarString(varLOINC); } //TES 11/22/2009 - PLID 36191 - Now go through and pull the other values out of our tree (use GetTreeValue, it will find the right row). _variant_t varDateReceived = GetTreeValue(pParentRow, lrfDateReceived, lrtcValue); if (varDateReceived.vt == VT_DATE) { dtReceived = VarDateTime(varDateReceived); if (dtReceived.GetStatus() == COleDateTime::valid) { strReceivedDate = FormatDateTimeForSql(dtReceived); } else { strReceivedDate = ""; } } else if (varDateReceived.vt == VT_BSTR) { if (VarString(varDateReceived).IsEmpty()) { strReceivedDate = ""; dtReceived.SetStatus(COleDateTime::invalid); } else { dtReceived.ParseDateTime(VarString(varDateReceived)); if (dtReceived.GetStatus() == COleDateTime::valid) { strReceivedDate = FormatDateTimeForSql(dtReceived); } else { strReceivedDate = ""; dtReceived.SetStatus(COleDateTime::invalid); } } } else { strReceivedDate = ""; dtReceived.SetStatus(COleDateTime::invalid); } // (a.walling 2010-02-25 15:56) - PLID 37546 - Date performed // (a.walling 2010-02-25 15:59) - PLID 37546 - Actually, modification of date performed is on hold for now. /* _variant_t varDatePerformed = GetTreeValue(pParentRow, lrfDatePerformed, lrtcValue); if (varDatePerformed.vt == VT_DATE) { dtPerformed = VarDateTime(varDatePerformed); if (dtPerformed.GetStatus() == COleDateTime::valid) { strPerformedDate = FormatDateTimeForSql(dtPerformed); } else { strPerformedDate = ""; } } else { // this should not be anything other than a date or nothing. ASSERT(varDatePerformed.vt == VT_NULL || varDatePerformed.vt == VT_EMPTY); strPerformedDate = ""; dtPerformed.SetStatus(COleDateTime::invalid); } */ _variant_t varValue = GetTreeValue(pParentRow, lrfSlideNum, lrtcValue); if(VT_BSTR == varValue.vt) { strSlideNum = VarString(varValue, ""); } strDiagnosis = VarString(GetTreeValue(pParentRow, lrfDiagnosis, lrtcValue), ""); varValue = GetTreeValue(pParentRow, lrfMicroscopicDescription, lrtcValue); // (r.galicki 2008-10-21 13:00) - PLID 31552 if(VT_BSTR == varValue.vt) { strMicroDesc = VarString(varValue, ""); } nFlagID = VarLong(GetTreeValue(pParentRow, lrfFlag,lrtcForeignKeyID), -1); strFlagName = VarString(GetTreeValue(pParentRow, lrfFlag, lrtcValue), ""); if (nFlagID == -1) { strFlagID = "NULL"; } else { //TES 8/6/2013 - PLID 51147 - If our priority hasn't already been overridden, or if our stored priority is lower than this priority, // then update the stored priority to match this priority // (j.armen 2014-07-08 10:06) - PLID 62150 - The value at the flag can be null. In this case, just use the default priority. strFlagID.Format("%li", nFlagID); long nTmpPriority = VarLong(GetTreeValue(pParentRow, lrfFlag, lrtcExtraValue), nTodoPriority); if(!bFlagFound) { nTodoPriority = nTmpPriority; bFlagFound = true; } else { if(nTmpPriority < nTodoPriority) { nTodoPriority = nTmpPriority; } } } nMailID = VarLong(GetTreeValue(pParentRow, lrfValue,lrtcForeignKeyID),-1); // (c.haag 2010-01-27) - PLID 41618 - Fill dtAttached if (nMailID != -1) { dtAttached = VarDateTime(GetTreeValue(pParentRow, lrfValue, lrtcDate)); } else { dtAttached = g_cdtInvalid; } // (j.gruber 2010-01-05 09:46) - PLID 36485 BOOL bTryAttach = FALSE; //-2 indicates a document was added if (nMailID == -2) { //it kinda sucks, but we need to attach the document here so that we have the mailID strDocPath = VarString(GetTreeValue(pParentRow, lrfValue, lrtcValue), ""); bTryAttach = TRUE; // (c.haag 2010-01-27) - PLID 41618 - Expect a CAttachedLabFile value CAttachedLabFile af = AttachFileToLab(strDocPath, dtAttached); nMailID = af.nMailID; } if (nMailID == -1) { if (bTryAttach) { // (j.gruber 2010-01-04 16:47) - PLID 36485 - let them know what is happening if (nResultID == -1) { MsgBox("The file %s could not be attached. The Value field will be cleared.", strDocPath); strMailID = "NULL"; strValue = ""; } else { //we'll get it down below } } else { strMailID = "NULL"; strValue = VarString(GetTreeValue(pParentRow, lrfValue,lrtcValue), ""); } } else { strMailID.Format("%li", nMailID); // (s.dhole 2010-10-21 15:57) - PLID 36938 set new tree value from mailid SetTreeValue(pParentRow, lrfValue,lrtcForeignKeyID ,nMailID); // (s.dhole 2010-10-21 15:57) - PLID 36938 get new file name from database CString strDocPathTemp = GetDocumentName(nMailID); if (!strDocPathTemp.IsEmpty()) { // (j.dinatale 2011-01-06) - PLID 42031 - if we end up with a MailID, then that means the file path must've changed, make sure that the current // file being displayed is the one on the server, not on the local machine. if(m_strCurrentFileName.CompareNoCase(strDocPath) == 0){ m_strCurrentFileName = GetPatientDocumentPath(m_nPatientID) ^ strDocPathTemp; // (j.dinatale 2011-03-01) - PLID 42031 - need to make sure we arent in report view, or in some cases the pdf gets loaded over the report if(m_nCurrentView != rvNexTechReport){ ReloadCurrentPDF(); } } strDocPath =strDocPathTemp; // (s.dhole 2010-10-21 15:57) - PLID 36938 set new tree value from File Path SetTreeValue(pParentRow, lrfValue,lrtcValue ,_variant_t(strDocPath)); SetAttachedFile(pParentRow,strDocPath); } //strDocPath = VarString(GetTreeValue(pParentRow, lrfValue,lrtcValue), ""); } strUnits = VarString(GetTreeValue(pParentRow, lrfUnits,lrtcValue), ""); // (c.haag 2009-05-06 14:49) - PLID 33789 strReference = VarString(GetTreeValue(pParentRow, lrfReference,lrtcValue), ""); // (z.manning 2009-04-30 16:49) - PLID 28560 strResultComments = VarString(GetTreeValue(pParentRow, lrfComments,lrtcValue), ""); //TES 12/1/2008 - PLID 32191 - Track the Status field. nStatusID = VarLong(GetTreeValue(pParentRow, lrfStatus,lrtcForeignKeyID), -1); strStatus = VarString(GetTreeValue(pParentRow, lrfStatus,lrtcValue), ""); if (nStatusID == -1) { strStatusID = "NULL"; } else { strStatusID.Format("%li", nStatusID); } // (c.haag 2009-05-07 14:57) - PLID 28561 - Acknowledged fields COleDateTime dtInvalid; dtInvalid.SetStatus(COleDateTime::invalid); nAcknowledgedUserID = VarLong(GetTreeValue(pParentRow, lrfAcknowledgedBy, lrtcForeignKeyID), -1); dtAcknowledgedDate = VarDateTime(GetTreeValue(pParentRow, lrfAcknowledgedOn, lrtcValue), dtInvalid); if (COleDateTime::valid == dtAcknowledgedDate.GetStatus()) { strAcknowledgedDate = FormatDateTimeForSql(dtAcknowledgedDate); } else { strAcknowledgedDate.Empty(); } // (c.haag 2010-11-30 17:34) - PLID 37372 - Result signature fields CString strSignatureFileName = VarString(pParentRow->GetValue(lrtcSignatureImageFile), ""); _variant_t varSignatureInkData = pParentRow->GetValue(lrtcSignatureInkData); _variant_t varSignatureTextData = pParentRow->GetValue(lrtcSignatureTextData); long nSignedByUserID = VarLong(pParentRow->GetValue(lrtcSignedBy),-1); COleDateTime dtSigned = VarDateTime(pParentRow->GetValue(lrtcSignedDate), dtInvalid); // (c.haag 2010-12-02 16:48) - PLID 41590 - Save completed fields long nCompletedByUserID = VarLong(pParentRow->GetValue(lrtcCompletedBy),-1); COleDateTime dtCompleted = VarDateTime(pParentRow->GetValue(lrtcCompletedDate), dtInvalid); CString strSigInkData; if(varSignatureInkData.vt == VT_NULL || varSignatureInkData.vt == VT_EMPTY) { strSigInkData = "NULL"; } else { strSigInkData = CreateByteStringFromSafeArrayVariant(varSignatureInkData); } CString strSigTextData; if(varSignatureTextData.vt == VT_NULL || varSignatureTextData.vt == VT_EMPTY) { strSigTextData = "NULL"; } else { strSigTextData = CreateByteStringFromSafeArrayVariant(varSignatureTextData); } CString strSignedDate = "NULL"; if(dtSigned.GetStatus() == COleDateTime::valid && dtSigned > COleDateTime(0.00)) { strSignedDate = "'" + FormatDateTimeForSql(dtSigned) + "'"; } CString strSignedBy = "NULL"; if(nSignedByUserID > 0){ strSignedBy.Format("%li", nSignedByUserID); } CString strCompletedDate = "NULL"; if(dtCompleted.GetStatus() == COleDateTime::valid && dtCompleted > COleDateTime(0.00)) { strCompletedDate = "'" + FormatDateTimeForSql(dtCompleted) + "'"; } CString strCompletedBy = "NULL"; if (nCompletedByUserID > 0) { strCompletedBy.Format("%li", nCompletedByUserID); } if (nResultID == -1) { bSpawnToDo = TRUE; CString strTempDesc; strTempDesc.Format("Result:%s was added with Flag: %s", strName, strFlagName); //TES 8/6/2013 - PLID 51147 - Pass in the priority we calculated m_pLabEntryDlg->AddToDoDescription(strTempDesc, (TodoPriority)nTodoPriority, true); //its a new result //TES 12/1/2008 - PLID 32191 - Added StatusID // (z.manning 2009-04-30 16:56) - PLID 28560 - Added comments // (c.haag 2009-05-06 15:21) - PLID 33789 - Added Units // (a.walling 2010-01-18 10:48) - PLID 36936 - Added LOINC // (c.haag 2010-11-30 17:34) - PLID 37372 - Added result signature fields // (c.haag 2010-12-10 9:44) - PLID 41590 - Added result complete fields AddStatementToSqlBatch(strSql, "INSERT INTO LabResultsT " "(LabID, Name, DateReceived, SlideTextID, DiagnosisDesc, ClinicalDiagnosisDesc, FlagID, Value, Units, Reference, MailID, StatusID, Comments, AcknowledgedUserID, AcknowledgedDate, LOINC, " "ResultSignatureInkData, ResultSignatureImageFile, ResultSignatureTextData, ResultSignedDate, ResultSignedBy, " "ResultCompletedDate, ResultCompletedBy " ") VALUES " " (%li, '%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s', %s, %s, '%s', %s, %s, '%s', " "%s, '%s', %s, %s, %s, " "%s, %s " "); \r\n ", nLabID, _Q(strName), strReceivedDate.IsEmpty() ? "NULL" : "'" + strReceivedDate + "'", _Q(strSlideNum), _Q(strDiagnosis), _Q(strMicroDesc), strFlagID, _Q(strValue), _Q(strUnits), _Q(strReference), strMailID, strStatusID, _Q(strResultComments), (-1 == nAcknowledgedUserID) ? "NULL" : AsString(nAcknowledgedUserID), (strAcknowledgedDate.IsEmpty()) ? "NULL" : ("'" + strAcknowledgedDate + "'"),_Q(strLOINC), strSigInkData, _Q(strSignatureFileName), strSigTextData, strSignedDate, strSignedBy, strCompletedDate, strCompletedBy ); AddStatementToSqlBatch(strSql, "INSERT INTO @TempLabInsertsT (ID, ArrayIndex) SELECT SCOPE_IDENTITY(), %li", aryNewRows.GetSize()); stResults *pRes = new stResults; //TES 12/7/2009 - PLID 36191 - The result ID will be filled in after we save. pRes->strResultName = strName; //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. pRes->dtReceivedDate = dtReceived; // (a.walling 2010-01-18 10:48) - PLID 36936 pRes->strLOINC = strLOINC; pRes->strSlideNum = strSlideNum; pRes->strDiagnosis = strDiagnosis; pRes->strMicroDesc = strMicroDesc; pRes->nFlagID = nFlagID; pRes->strFlag = strFlagName; pRes->strValue = strValue; pRes->strUnits = strUnits; // (c.haag 2009-05-06 15:22) - PLID 33789 pRes->strReference = strReference; pRes->nMailID = nMailID; pRes->strDocPath = strDocPath; pRes->nStatusID = nStatusID; pRes->strStatus = strStatus; //TES 12/1/2008 - PLID 32191 pRes->strComments = strResultComments; // (z.manning 2009-04-30 16:57) - PLID 28560 pRes->nAcknowledgedUserID = nAcknowledgedUserID; // (c.haag 2009-05-07 14:56) - PLID 28561 pRes->dtAcknowledgedDate = dtAcknowledgedDate; // (c.haag 2009-05-07 14:57) - PLID 28561 //TES 12/7/2009 - PLID 36191 - Track which row this result is associated with. pRes->pRow = pParentRow; //mail ID is going to be taken care of with the value field aryNewRows.Add(((stResults *)pRes)); // (b.spivey, March 26, 2013) - PLID 55943 - Add this lab ID to the list to check for. if (nSignedByUserID > 0) { aryLabIDs.Add(nLabID); } } else { // (j.gruber 2010-02-24 13:56) - PLID 37510 BOOL bCheckLab = FALSE; //we updated something bool bForceUpdate = false; // (j.dinatale 2013-03-07 17:02) - PLID 34339 - in one case we want to force an update CString strUpdate = "UPDATE LabResultsT SET "; CString strUpdateName, strUpdateValue, strCheckValue; CString strAuditOldName, strAuditNewName; long nAuditID; enum upType { upNumber = 0, upString, upDate, } updateType; //TES 11/22/2009 - PLID 36191 - First check the name (parent row) stResults *pstRes; if (!m_mapResults.Lookup(nResultID, pstRes)) { ASSERT(FALSE); } strUpdateName = "Name"; strCheckValue = pstRes->strResultName; strUpdateValue = strName; nAuditID = aeiLabResultName; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; if (strCheckValue != strUpdateValue) { CString strTemp; strTemp.Format(" %s = '%s', ", strUpdateName, _Q(strUpdateValue)); strUpdate += strTemp; if (nAuditTransactionID == -1) { nAuditTransactionID = BeginAuditTransaction(); } if (strUpdateValue == "NULL") { strUpdateValue = ""; } if (strCheckValue == "NULL") { strCheckValue = ""; } if (nAuditID != -1) { AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, nAuditID, nResultID, strAuditOldName, strAuditNewName, aepMedium, aetChanged); } // (j.gruber 2010-02-24 13:56) - PLID 37510 bCheckLab = TRUE; } //TES 11/22/2009 - PLID 36191 - Now loop through the child rows IRowSettingsPtr pRow = pParentRow->GetFirstChildRow(); while(pRow) { bForceUpdate = false; // (j.dinatale 2013-03-07 17:02) - PLID 34339 - in one case we want to force an update stResults *pstRes; if (!m_mapResults.Lookup(nResultID, pstRes)) { ASSERT(FALSE); } // (j.jones 2010-04-21 10:27) - PLID 38300 - reset these fields // for each row, they are only filled if we are saving a change strUpdateName = ""; strCheckValue = ""; strUpdateValue = ""; LabResultField lrf = (LabResultField)VarLong(pRow->GetValue(lrtcFieldID)); switch (lrf) { // (j.jones 2010-04-21 10:27) - PLID 38300 - Date Performed is a potential field // in the list, but it is not currently updateable, so reset strUpdateName to be empty case lrfDatePerformed: strUpdateName = ""; strCheckValue = ""; strUpdateValue = ""; break; case lrfDateReceived: strUpdateName = "DateReceived"; updateType = upDate; //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. if (pstRes->dtReceivedDate.GetStatus() != COleDateTime::valid) { strCheckValue = "NULL"; updateType = upDate; strAuditOldName = ""; } else { strCheckValue = FormatDateTimeForSql(pstRes->dtReceivedDate); updateType = upString; if (pstRes->dtReceivedDate.GetStatus() == COleDateTime::valid) { strAuditOldName = FormatDateTimeForInterface(pstRes->dtReceivedDate); } else { ASSERT(FALSE); strAuditOldName = ""; } } if (dtReceived.GetStatus() != COleDateTime::valid) { strUpdateValue = "NULL"; updateType = upDate; strAuditNewName = ""; } else { strUpdateValue = FormatDateTimeForSql(dtReceived); updateType = upString; if (dtReceived.GetStatus() == COleDateTime::valid) { strAuditNewName = FormatDateTimeForInterface(dtReceived); } else { ASSERT(FALSE); strAuditNewName = ""; } } nAuditID = aeiLabResultReceivedDate; break; // (a.walling 2010-01-18 10:50) - PLID 36936 case lrfLOINC: strUpdateName = "LOINC"; updateType = upString; strCheckValue = pstRes->strLOINC; strUpdateValue = strLOINC; nAuditID = aeiLabResultLOINC; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; case lrfSlideNum: strUpdateName = "SlideTextID"; updateType = upString; strCheckValue = pstRes->strSlideNum; strUpdateValue = strSlideNum; nAuditID = aeiLabResultSlideNumber; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; case lrfDiagnosis: strUpdateName = "DiagnosisDesc"; updateType = upString; strCheckValue = pstRes->strDiagnosis; strUpdateValue = strDiagnosis; nAuditID = aeiLabResultDiagnosis; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; case lrfMicroscopicDescription: strUpdateName = "ClinicalDiagnosisDesc"; updateType = upString; strCheckValue = pstRes->strMicroDesc; strUpdateValue = strMicroDesc; nAuditID = aeiLabResultMicroDesc; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; case lrfFlag: strUpdateName = "FlagID"; updateType = upNumber; if (pstRes->nFlagID == -1) { strCheckValue = "NULL"; strAuditOldName = ""; } else { strCheckValue = AsString(pstRes->nFlagID); strAuditOldName = pstRes->strFlag; } if (nFlagID == -1) { strUpdateValue = "NULL"; strAuditNewName = ""; } else { strUpdateValue = AsString(nFlagID); strAuditNewName = strFlagName; } nAuditID = aeiLabResultFlagID; break; case lrfValue: { // (j.gruber 2010-01-05 09:46) - PLID 36485 BOOL bTryAttach2 = FALSE; if(nMailID == -2) { //attach the document here, since we need the mail ID bTryAttach2 = TRUE; // (c.haag 2010-01-27) - PLID 41618 - Expect a CAttachedLabFile value CAttachedLabFile af = AttachFileToLab(strDocPath, dtAttached); nMailID = af.nMailID; } if(nMailID > 0) { bForceUpdate = true; // (j.dinatale 2013-03-07 17:02) - PLID 34339 - we want to force an update here strUpdateName = "MailID"; updateType = upNumber; if (pstRes->nMailID == -1) { strCheckValue = "NULL"; } else { strCheckValue = AsString(pstRes->nMailID); } strUpdateValue = AsString(nMailID); // (j.dinatale 2011-01-06) - PLID 42031 - if we end up with a MailID, then that means the file path maybe changed, make sure that the current // file being displayed the one on the server instead of the local copy. if(m_strCurrentFileName.CompareNoCase(strDocPath) == 0){ CString strDocPathTemp = GetDocumentName(nMailID); if (!strDocPathTemp.IsEmpty()) { m_strCurrentFileName = GetPatientDocumentPath(m_nPatientID) ^ strDocPathTemp; // (j.dinatale 2011-03-01) - PLID 42031 - need to make sure we arent in report view, or in some cases the pdf gets loaded over the report if(m_nCurrentView != rvNexTechReport){ ReloadCurrentPDF(); } } } } else { if (bTryAttach || bTryAttach2) { MsgBox("The file %s could not be attached. The Value field will be reverted.", strDocPath); //don't update anything strUpdateName = ""; updateType = upString; strCheckValue = pstRes->strValue; } else { strUpdateName = "Value"; updateType = upString; strCheckValue = pstRes->strValue; strUpdateValue = strValue; nAuditID = aeiLabResultValue; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; } } } break; // (c.haag 2009-05-06 14:51) - PLID 33789 case lrfUnits: strUpdateName = "Units"; updateType = upString; strCheckValue = pstRes->strUnits; strUpdateValue = strUnits; nAuditID = aeiLabResultUnits; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; case lrfReference: strUpdateName = "Reference"; updateType = upString; strCheckValue = pstRes->strReference; strUpdateValue = strReference; nAuditID = aeiLabResultReference; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; // (z.manning 2009-04-30 16:49) - PLID 28560 case lrfComments: strUpdateName = "Comments"; updateType = upString; strCheckValue = pstRes->strComments; strUpdateValue = strResultComments; nAuditID = aeiLabResultComments; strAuditOldName = strCheckValue; strAuditNewName = strUpdateValue; break; case lrfStatus: //TES 12/1/2008 - PLID 32191 - Track the Status field strUpdateName = "StatusID"; updateType = upNumber; if (pstRes->nStatusID == -1) { strCheckValue = "NULL"; strAuditOldName = ""; } else { strCheckValue = AsString(pstRes->nStatusID); strAuditOldName = pstRes->strStatus; } if (nStatusID == -1) { strUpdateValue = "NULL"; strAuditNewName = ""; } else { strUpdateValue = AsString(nStatusID); strAuditNewName = strStatus; } nAuditID = aeiLabResultStatusID; break; // (c.haag 2009-05-07 15:01) - PLID 28561 - Acknowledged fields case lrfAcknowledgedBy: strUpdateName = "AcknowledgedUserID"; updateType = upNumber; if (pstRes->nAcknowledgedUserID == -1) { strCheckValue = "NULL"; strAuditOldName = ""; } else { strCheckValue = AsString(pstRes->nAcknowledgedUserID); strAuditOldName = GetExistingUserName(pstRes->nAcknowledgedUserID); } if (nAcknowledgedUserID == -1) { strUpdateValue = "NULL"; strAuditNewName = ""; } else { strUpdateValue = AsString(nAcknowledgedUserID); strAuditNewName = GetExistingUserName(nAcknowledgedUserID); } nAuditID = aeiLabResultAcknowledgedUserID; break; // (c.haag 2009-05-07 15:01) - PLID 28561 - Acknowledged fields case lrfAcknowledgedOn: strUpdateName = "AcknowledgedDate"; updateType = upDate; if (pstRes->dtAcknowledgedDate.GetStatus() != COleDateTime::valid) { strCheckValue = "NULL"; updateType = upDate; strAuditOldName = ""; } else { strCheckValue = FormatDateTimeForSql(pstRes->dtAcknowledgedDate); updateType = upString; if (pstRes->dtAcknowledgedDate.GetStatus() == COleDateTime::valid) { strAuditOldName = FormatDateTimeForInterface(pstRes->dtAcknowledgedDate); } else { ASSERT(FALSE); strAuditOldName = ""; } } if (dtAcknowledgedDate.GetStatus() != COleDateTime::valid) { strUpdateValue = "NULL"; updateType = upDate; strAuditNewName = ""; } else { strUpdateValue = FormatDateTimeForSql(dtAcknowledgedDate); updateType = upString; if (dtAcknowledgedDate.GetStatus() == COleDateTime::valid) { strAuditNewName = FormatDateTimeForInterface(dtAcknowledgedDate); } else { ASSERT(FALSE); strAuditNewName = ""; } } nAuditID = aeiLabResultAcknowledgedDate; break; } if (!strUpdateName.IsEmpty()) { // (j.dinatale 2013-03-07 17:02) - PLID 34339 - in one case we want to force an update if (bForceUpdate || strCheckValue != strUpdateValue) { CString strTemp; // (j.gruber 2010-02-24 13:56) - PLID 37510 if (strUpdateName == "Value" || strUpdateName == "Name") { bCheckLab = TRUE; } if (updateType == upNumber) { if (strUpdateName == "FlagID") { //prompt for a todo creation no matter what changed //if (strCheckValue == "NULL" && strUpdateValue != "NULL") { bSpawnToDo = TRUE; CString strTempDesc; strTempDesc.Format("Result:%s had flag changed from %s to %s", strName, strAuditOldName.IsEmpty() ? "<No Flag>" : strAuditOldName, strAuditNewName.IsEmpty() ? "<No Flag>" : strAuditNewName); //TES 8/6/2013 - PLID 51147 - Pass in the todo priority we've calculated m_pLabEntryDlg->AddToDoDescription(strTempDesc, (TodoPriority)nTodoPriority, !strAuditNewName.IsEmpty()); //} } strTemp.Format(" %s = %s, ", strUpdateName, strUpdateValue); } else if (updateType == upString) { strTemp.Format(" %s = '%s', ", strUpdateName, _Q(strUpdateValue)); } else if (updateType == upDate) { strTemp.Format(" %s = %s, ", strUpdateName, strUpdateValue); } else { ASSERT(FALSE); } strUpdate += strTemp; if (nAuditTransactionID == -1) { nAuditTransactionID = BeginAuditTransaction(); } if (strUpdateValue == "NULL") { strUpdateValue = ""; } if (strCheckValue == "NULL") { strCheckValue = ""; } if (nAuditID != -1) { AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, nAuditID, nResultID, strAuditOldName, strAuditNewName, aepMedium, aetChanged); } } } pRow = pRow->GetNextRow(); } // (c.haag 2010-11-30 17:34) - PLID 37372 - Result signature fields long nSavedSignedByUserID = VarLong(pParentRow->GetValue(lrtcSavedSignedBy),-1); COleDateTime dtSavedSigned = VarDateTime(pParentRow->GetValue(lrtcSavedSignedDate), dtInvalid); BOOL bSaveInkData = FALSE; if (nSavedSignedByUserID != nSignedByUserID) { // (b.spivey, March 19, 2013) - PLID 55943 - Add this lab ID to the list to check for. aryLabIDs.Add(nLabID); bSaveInkData = TRUE; strUpdate += FormatString("ResultSignedBy = %s, ", (-1 == nSignedByUserID) ? "NULL" : AsString(nSignedByUserID)); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiPatientLabResultSigned, nResultID, "", "<Signed>", aepMedium, aetChanged); } // (j.kuziel 2011-10-12 11:24) - PLID 43789 - COleDateTime objects will not compare when both are invalid, an 'undefined' state. if(dtSavedSigned.GetStatus() != COleDateTime::valid && dtSigned.GetStatus() != COleDateTime::valid) { // Both dates are not in valid states. Do not update. } else { if (dtSavedSigned != dtSigned) { bSaveInkData = TRUE; strUpdate += FormatString("ResultSignedDate = %s, ", (COleDateTime::invalid == dtSigned.GetStatus()) ? "NULL" : ("'" + FormatDateTimeForSql(dtSigned) + "'")); // This cannot be edited, and therefore does not need audited. There is 1 generic audit for "signed". } } if (bSaveInkData) { //ResultSignatureInkData, ResultSignatureImageFile, ResultSignatureTextData strUpdate += FormatString("ResultSignatureInkData = %s, ", strSigInkData); strUpdate += FormatString("ResultSignatureImageFile = '%s', ", _Q(strSignatureFileName)); strUpdate += FormatString("ResultSignatureTextData = %s, ", strSigTextData); // This cannot be edited, and therefore does not need audited. There is 1 generic audit for "signed". } // (c.haag 2010-12-02 16:48) - PLID 41590 - Save completed fields long nSavedCompletedByUserID = VarLong(pParentRow->GetValue(lrtcSavedCompletedBy),-1); COleDateTime dtSavedCompleted = VarDateTime(pParentRow->GetValue(lrtcSavedCompletedDate), dtInvalid); if (nSavedCompletedByUserID != nCompletedByUserID) { // (c.haag 2010-12-20) - PLID 38633 - We used to audit completing a lab at the lab level. Now when // auditing, we need to do it to the results, and include some lab information in the process. CString strFormNumberTextID = m_pLabEntryDlg->GetFormNumber(); IRowSettingsPtr pSpecRow = GetSpecFromCurrentRow(pParentRow); CString strSpecimen = VarString(pSpecRow->GetValue(lrtcSpecimen),""); CString strResultName = VarString(GetTreeValue(pParentRow, lrfName, lrtcValue), ""); CString strOld = strFormNumberTextID + " - " + strSpecimen + " - " + strResultName; strUpdate += FormatString("ResultCompletedBy = %s, ", (-1 == nCompletedByUserID) ? "NULL" : AsString(nCompletedByUserID)); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiPatientLabResultMarkedComplete, nResultID, strOld, "<Completed>", aepMedium, aetChanged); } // (j.kuziel 2011-10-12 11:08) - PLID 43789 - COleDateTime objects will not compare when both are invalid, an 'undefined' state. if (dtSavedCompleted.GetStatus() != COleDateTime::valid && dtCompleted.GetStatus() != COleDateTime::valid) { // Both dates are not in valid states. Do not update. } else { if(dtSavedCompleted != dtCompleted) { strUpdate += FormatString("ResultCompletedDate = %s, ", (COleDateTime::invalid == dtCompleted.GetStatus()) ? "NULL" : ("'" + FormatDateTimeForSql(dtCompleted) + "'")); // This cannot be edited, and therefore does not need audited. There is 1 generic audit for "completed". } } if (strUpdate != "UPDATE LabResultsT SET ") { //remove the last comma strUpdate = strUpdate.Left(strUpdate.GetLength() - 2); //add it to the batch strUpdate += " WHERE ResultID = " + AsString(nResultID) + ";\r\n"; AddStatementToSqlBatch(strSql, "%s", strUpdate); // (j.gruber 2010-02-24 10:05) - PLID 37510 - add to our array if (bCheckLab) { dwaryResultIDs.Add(nResultID); } } } pParentRow = pParentRow->GetNextRow(); } pLabRow = pLabRow->GetNextRow(); } //now declare after the inserts, if there were any //AddDeclarationToSqlBatch(strSql, "DECLARE @nEndResultID INT; \r\n"); //AddDeclarationToSqlBatch(strSql, "SET @nEndResultID = (SELECT COALESCE(Max(ResultID), 0)+1 FROM LabResultsT) \r\n"); AddStatementToSqlBatch(strSql, "SET NOCOUNT OFF"); //AddStatementToSqlBatch(strSql, " SELECT @nStartResultID as StartResultID, @nEndResultID as EndResultID; \r\n"); AddStatementToSqlBatch(strSql, "SELECT ID, ArrayIndex FROM @TempLabInsertsT"); //now execute _RecordsetPtr rs = CreateRecordsetStd("BEGIN TRAN \r\n " + strSql + " COMMIT TRAN \r\n"); // (b.spivey, April 22, 2013) - PLID 55943 - only bother if we know we have steps to complete. if (aryLabIDs.GetCount() > 0) { // (b.spivey, April 24, 2013) - PLID 55943 - There is a case where if we just created this, the lab may not have sync'd yet // so here, we pre-sync. for (int i = 0; i < aryLabIDs.GetCount(); i++) { long nLabID = aryLabIDs.GetAt(i); SyncTodoWithLab(nLabID, GetPatientID()); } // (b.spivey, March 18, 2013) - PLID 55943 - Update any lab steps that should be // completed by signing all results. _RecordsetPtr prsStepsCompleteBySigning = CreateParamRecordset( "SELECT LST.StepID, LST.LabID " "FROM LabStepsT LST " "INNER JOIN LabProcedureStepsT LPST ON LST.LabProcedureStepID = LPST.StepID " "LEFT JOIN ( " " SELECT MIN(CASE WHEN LabResultsT.ResultSignedDate IS NOT NULL THEN 1 ELSE 0 END) AS AllSigned, LabID " " FROM LabResultsT " " WHERE Deleted = 0 " " GROUP BY LabID " ") LabResultsT ON LST.LabID = LabResultsT.LabID " "WHERE LST.LabID IN ({INTARRAY}) AND LPST.CompletedBySigning = {BIT} " " AND LabresultsT.AllSigned = 1 " "ORDER BY LST.LabID, LST.StepOrder ", aryLabIDs, TRUE); while (!prsStepsCompleteBySigning->eof) { long nLabIDFromQuery = AdoFldLong(prsStepsCompleteBySigning->Fields, "LabID", -1); long nStepID = AdoFldLong(prsStepsCompleteBySigning->Fields, "StepID", -1); GlobalModifyStepCompletion(nLabIDFromQuery, nStepID, true, true); prsStepsCompleteBySigning->MoveNext(); } } { // (b.spivey, April 05, 2013) - PLID 44387 - This code block handles marking open lab steps as completed and syncing todos. CArray<long, long> aryAllLabs; //Get all LabIDs for this req. GetAllLabIDsAry(aryAllLabs); bool bCompleteAllLabSteps = false; //I wanted the message to be a litttle clearer-- we only allow them to mark all open lab steps complete or not, not selectively per lab. CString strCompleteMultipleLabs = (aryAllLabs.GetCount() > 1 ? "Do you want to mark all open lab steps for any newly completed specimen(s) as completed?" : "Do you want to mark all open lab steps for this lab as completed?"); for(int i = 0; i < aryAllLabs.GetCount(); i++) { long nLabID = aryAllLabs.GetAt(i); // (b.spivey, April 09, 2013) - PLID 44387 - We're checking to see if we should even bother this lab-- if it // started as completed then we leave it be. bool bLoadedAsIncompleted = !!VarBool(GetLabRowByID(nLabID)->GetValue(lrtcLoadedAsIncomplete), FALSE); // (b.spivey, April 05, 2013) - PLID 44387 - We have to do this check per lab because a lab may not be completed or have // results. //Check that the lab started as incompleted. //Checking for a lab having results, //and that those results are completed, and that that lab has lab steps remaining to complete, //and either (a) we've decided to complete all lab steps for all valid labs or // (b) They explicitly say complete all lab steps for all valid labs //Be careful if you change this order. The check short circuits to avoid running the queries or throwing a message box // unless we know we have to. And AllResultsAreCompleted will return true with no results. if(bLoadedAsIncompleted && DoesLabHaveResults(nLabID) && AllResultsAreCompleted(nLabID) && ReturnsRecordsParam("SELECT StepID FROM LabStepsT WHERE StepCompletedDate IS NULL AND StepCompletedBy IS NULL AND LabID = {INT} ", nLabID) && (bCompleteAllLabSteps || MessageBox(strCompleteMultipleLabs, "NexTech Practice", MB_YESNO|MB_ICONWARNING) == IDYES)) { bCompleteAllLabSteps = true; // Complete lab steps. // (b.spivey, April 23, 2013) - PLID 44387 - Complete steps. _RecordsetPtr prsUncompleteSteps = CreateParamRecordset( "BEGIN TRAN " "SET NOCOUNT ON " "SELECT StepID " "FROM LabStepsT " "WHERE StepCompletedDate IS NULL AND StepCompletedBy IS NULL " " AND LabID = {INT} " " " "UPDATE LabStepsT " "SET StepCompletedDate = GETDATE(), StepCompletedBy = {INT} " "WHERE StepCompletedDate IS NULL AND StepCompletedBy IS NULL " " AND LabID = {INT} " "SET NOCOUNT OFF " "COMMIT TRAN " , nLabID , GetCurrentUserID() , nLabID); // (b.spivey, April 23, 2013) - PLID 44387 - Audit. //We updated something! if(!prsUncompleteSteps->eof) { long nAuditID = BeginNewAuditEvent(); CAuditTransaction auditTran; long nPatientID = GetPatientID(); CString strPatientName = GetExistingPatientName(nPatientID); //audit. while(!prsUncompleteSteps->eof) { long nRecordID = AdoFldLong(prsUncompleteSteps->Fields, "StepID", -1); CString strOld = GenerateStepCompletionAuditOld(nRecordID); CString strNew = "<Completed>"; AuditEvent(nPatientID, strPatientName, auditTran, aeiPatientLabStepMarkedComplete, nRecordID, strOld, strNew, aepMedium, aetChanged); prsUncompleteSteps->MoveNext(); } //Commit transaction. auditTran.Commit(); } } // (b.spivey, April 22, 2013) - PLID 55943 - Need to sync todos for signed results. // (f.gelderloos 2013-07-10 10:39) - PLID 57448 - This was causing too many TODO items to be created when a lab dlg is closed. // Steps cannot be modified anyway, so this was pointless i think? //Sync todos for every lab. //SyncTodoWithLab(nLabID, m_nPatientID); } } //bye //TES 12/7/2009 - PLID 36191 - Track how many results we've added. int nNewResultCount = 0; while (! rs->eof) { //long nStartResultID = AdoFldLong(rs, "StartResultID"); //long nEndResultID = AdoFldLong(rs, "EndResultID"); //int nCount = 0; //for (int i = nStartResultID; i < nEndResultID; i++ ) { if (nAuditTransactionID == -1) { nAuditTransactionID = BeginAuditTransaction(); } stResults *pRes = ((stResults*)aryNewRows.GetAt(AdoFldLong(rs, "ArrayIndex"))); long nResultID = AdoFldLong(rs, "ID"); // (j.gruber 2010-02-24 10:05) - PLID 37510 - add to our array dwaryResultIDs.Add(nResultID); //TES 12/7/2009 - PLID 36191 - Copy the new result ID to the associated row, as well as its children. IRowSettingsPtr pResultRow = pRes->pRow; pResultRow->PutValue(lrtcResultID, nResultID); IRowSettingsPtr pChildRow = pResultRow->GetFirstChildRow(); while(pChildRow) { pChildRow->PutValue(lrtcResultID, nResultID); pChildRow = pChildRow->GetNextRow(); } //TES 12/7/2009 - PLID 36191 - This is now an existing result, so put it in our map. m_mapResults.SetAt(nResultID, pRes); nNewResultCount++; AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultCreated, nResultID, "", "<Created - Entries to follow>", aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultName, nResultID, "", pRes->strResultName, aepHigh, aetCreated); //TES 12/1/2008 - PLID 32281 - It now stores the date received as a COleDateTime, not a CString. AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultReceivedDate, nResultID, "", FormatDateTimeForInterface(pRes->dtReceivedDate), aepHigh, aetCreated); // (a.walling 2010-01-18 10:53) - PLID 36936 AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultLOINC, nResultID, "", pRes->strLOINC, aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultSlideNumber, nResultID, "", pRes->strSlideNum, aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultDiagnosis, nResultID, "", pRes->strDiagnosis, aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultMicroDesc, nResultID, "", pRes->strMicroDesc, aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultFlagID, nResultID, "", pRes->strFlag, aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultValue, nResultID, "", pRes->strValue, aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultUnits, nResultID, "", pRes->strUnits, aepHigh, aetCreated); // (c.haag 2009-05-06 15:23) - PLID 33789 AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultReference, nResultID, "", pRes->strReference, aepHigh, aetCreated); //TES 12/1/2008 - PLID 32191 - Audit the Status field AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultStatusID, nResultID, "", pRes->strStatus, aepHigh, aetCreated); // (z.manning 2009-04-30 16:52) - PLID 28560 - Added lab result comments AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultComments, nResultID, "", pRes->strComments, aepHigh, aetCreated); // (c.haag 2009-05-07 15:08) - PLID 28561 - Added lab result acknowledged fields AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultAcknowledgedUserID, nResultID, "", (-1 == pRes->nAcknowledgedUserID) ? "" : GetExistingUserName(pRes->nAcknowledgedUserID), aepHigh, aetCreated); AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiLabResultAcknowledgedDate, nResultID, "", (COleDateTime::invalid == pRes->dtAcknowledgedDate.GetStatus()) ? "" : FormatDateTimeForInterface(pRes->dtAcknowledgedDate), aepHigh, aetCreated); // (c.haag 2011-01-25) - PLID 38633 - Audit whether this new result is signed or completed. long nSignedByUserID = VarLong(pResultRow->GetValue(lrtcSignedBy),-1); if (nSignedByUserID > 0) { AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiPatientLabResultSigned, nResultID, "", "<Signed>", aepMedium, aetCreated); } long nCompletedByUserID = VarLong(pResultRow->GetValue(lrtcCompletedBy),-1); if (nCompletedByUserID > 0) { AuditEvent(m_nPatientID, strPersonName, nAuditTransactionID, aeiPatientLabResultMarkedComplete, nResultID, "", "<Completed>", aepMedium, aetCreated); } rs->MoveNext(); } //TES 5/2/2011 - PLID 43428 - We've saved now, so update our saved status m_strSavedOrderStatus = strOrderStatus; //now we have to delete the res pointers if they exist //TES 12/7/2009 - PLID 36191 - We no longer need to delete these, because we moved all of them to the existing results map. However, // we do want to make sure we had the expected number of new results. if(nNewResultCount != aryNewRows.GetSize()) { AfxThrowNxException("Mismatched result count when saving new Lab Results (expected %i new results, found %i)", aryNewRows.GetSize(), nNewResultCount); } // (j.gruber 2010-02-24 10:05) - PLID 37510 - call our function to check the new results against decision rules if (dwaryResultIDs.GetSize() > 0) { // (c.haag 2010-09-21 12:15) - PLID 40612 - We now pass in the patient ID //TES 10/31/2013 - PLID 59251 - Pass in arNewCDSInterventions UpdateDecisionRules(GetRemoteData(), m_nPatientID, arNewCDSInterventions); } // (c.haag 2010-07-21 11:40) - PLID 30894 - Send a labs table checker because lab result data has changed // (r.gonet 08/25/2014) - PLID 63221 - Send a table checker for all labs on the patient CClient::RefreshLabsTable(m_nPatientID, -1); } // (b.spivey, April 05, 2013) - PLID 44387 - Throw in an array, get all lab IDs for this lab. void CLabResultsTabDlg::GetAllLabIDsAry(OUT CArray<long, long>& aryLabIDs) { IRowSettingsPtr pRow = m_pResultsTree->GetFirstRow(); while (pRow) { aryLabIDs.Add(VarLong(pRow->GetValue(lrtcForeignKeyID))); pRow = pRow->GetNextRow(); } } // (b.spivey, April 05, 2013) - PLID 44387 - Check if this lab has any results. bool CLabResultsTabDlg::DoesLabHaveResults(long nLabID) { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if(pLabRow) { if (pLabRow->GetFirstChildRow()) { return true; } } return false; } // (c.haag 2010-01-27) - PLID 41618 - We now return a CAttachedLabFile object that has values for // the mail ID and attachment, and take in an attachment date CAttachedLabFile CLabResultsTabDlg::AttachFileToLab(CString strSourcePath, const COleDateTime& dtAttached) { CString strFileName = GetFileName(strSourcePath); CString strDstPath = GetPatientDocumentPath(m_nPatientID) ^ strFileName; long nMailID = -1; // (m.hancock 2006-06-30 11:10) - PLID 21280 - Adding a preference for assigning default attachment category long nCategoryID = (long)GetRemotePropertyInt("LabAttachmentsDefaultCategory",-1,0,"<None>",true); //TES 8/2/2011 - PLID 44814 - Check whether they're allowed to use the default category if(nCategoryID != -1 && !CheckCurrentUserPermissions(bioHistoryCategories, sptView, TRUE, nCategoryID, TRUE)) { nCategoryID = -1; } // (a.walling 2007-08-21 07:54) - PLID 26748 - Need to support Office 2007 files // (a.walling 2007-10-12 14:04) - PLID 26342 - Also support macro-enabled 2007 documents CString strType; if ( (strDstPath.Right(4).CompareNoCase(".doc") == 0) || (strDstPath.Right(5).CompareNoCase(".docx") == 0) || (strDstPath.Right(5).CompareNoCase(".docm") == 0)) strType = SELECTION_WORDDOC; else strType = SELECTION_FILE; // (j.jones 2012-10-08 14:03) - PLID 44263 - If the file is being attached from the // documents folder, find the existing MailID and return it, so we do not add a // redundant MailSent entry. In the off chance that the file is in the documents // folder but not attached, then we would need to properly attach it. if(strSourcePath == strDstPath) { _RecordsetPtr rs = CreateParamRecordset("SELECT MailID FROM MailSent WHERE PersonID = {INT} AND PathName = {STRING}", m_nPatientID, strFileName); if(!rs->eof) { nMailID = VarLong(rs->Fields->Item["MailID"]->Value); //do not update the date of the existing entry in MailSent } else { nMailID = ::AttachFileToHistory(strDstPath, m_nPatientID, GetSafeHwnd(), nCategoryID, strType, NULL, -1, -1); //Update the attachment date to the time the user actually added it to the lab. We //want to maintain a consistent ordering of attached document dates. ExecuteParamSql("UPDATE MailSent SET [Date] = {OLEDATETIME} WHERE MailID = {INT}", dtAttached, nMailID); } rs->Close(); //return now, because do not need to actually copy this file CAttachedLabFile af; af.nMailID = nMailID; af.strFileName = GetPatientDocumentPath(m_nPatientID) ^ GetFileName(strSourcePath); af.dtAttached = dtAttached; return af; } if (CopyFile(strSourcePath, strDstPath, TRUE)) { // (m.hancock 2006-06-27 16:31) - PLID 21071 - Attach the file to history and this lab step, returning the MailID nMailID = ::AttachFileToHistory(strDstPath, m_nPatientID, GetSafeHwnd(), nCategoryID, strType, NULL, -1, -1); } else { //If the file already exists here, prompt for rename/cancel DWORD dwLastError = GetLastError(); if(dwLastError == ERROR_FILE_EXISTS) { //TES 12/17/2009 - PLID 36634 - If this file already exists, maybe that's because we're attaching something that's already in // the default folder. if(strDstPath.CompareNoCase(strSourcePath) == 0) { //TES 12/17/2009 - PLID 36634 - Yup, that's the case, so no need to prompt the user to rename, just attach it in place. nMailID = ::AttachFileToHistory(strDstPath, m_nPatientID, GetSafeHwnd(), nCategoryID, strType, NULL, -1, -1); dwLastError = GetLastError(); } else { strDstPath = GetPatientDocumentPath(m_nPatientID); CRenameFileDlg dlgRename(strSourcePath, strDstPath, this); try { if(dlgRename.DoModal() == IDOK) { strDstPath = dlgRename.m_strDstFullPath; if(CopyFile(strSourcePath, strDstPath, TRUE)) { // (m.hancock 2006-06-27 16:31) - PLID 21071 - Attach the file to history and this lab step, returning the MailID nMailID = ::AttachFileToHistory(strDstPath, m_nPatientID, GetSafeHwnd(), nCategoryID, strType, NULL, -1, -1); } } dwLastError = GetLastError(); }NxCatchAll("Error in CPatientLabsDlg::OnImportAndAttachExistingFile:RenamingFile"); } } //there's an error other than the file already existing if(dwLastError != ERROR_SUCCESS) { CString strError; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwLastError, 0, strError.GetBuffer(MAX_PATH), MAX_PATH, NULL); if(IDNO == MsgBox(MB_YESNO, "The file '%s' could not be imported into the patient's documents folder. Windows returned the following error message:\r\n\r\n" "%s\r\n" "Would you like to continue?", GetFileName(strSourcePath), strError)) { // (c.haag 2010-01-27) - PLID 41618 - Return a CAttachedLabFile object instead. Defaults to a -1 MailID. CAttachedLabFile af; return af; } } } if (nMailID == 0) { // (c.haag 2010-01-27) - PLID 41618 - Return a CAttachedLabFile object instead. Defaults to a -1 MailID. CAttachedLabFile af; return af; } else { // (c.haag 2010-01-27) - PLID 41618 - Update the attachment date to the time the user actually added it to the lab. We // want to maintain a consistent ordering of attached document dates. ExecuteParamSql("UPDATE MailSent SET [Date] = {OLEDATETIME} WHERE MailID = {INT}", dtAttached, nMailID); CAttachedLabFile af; af.nMailID = nMailID; af.strFileName = GetPatientDocumentPath(m_nPatientID) ^ GetFileName(strSourcePath); af.dtAttached = dtAttached; return af; } } BEGIN_EVENTSINK_MAP(CLabResultsTabDlg, CNxDialog) ON_EVENT(CLabResultsTabDlg, IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST, 16, CLabResultsTabDlg::OnSelChosenClinicalDiagnosisOptionsList, VTS_DISPATCH) ON_EVENT(CLabResultsTabDlg, IDC_LAB_FLAG, 20, CLabResultsTabDlg::OnTrySetSelFinishedLabFlag, VTS_I4 VTS_I4) ON_EVENT(CLabResultsTabDlg, IDC_LAB_FLAG, 16, CLabResultsTabDlg::OnSelChosenLabFlag, VTS_DISPATCH) ON_EVENT(CLabResultsTabDlg, IDC_LAB_FLAG, 18, CLabResultsTabDlg::OnRequeryFinishedLabFlag, VTS_I2) ON_EVENT(CLabResultsTabDlg, IDC_LAB_STATUS, 18, CLabResultsTabDlg::OnRequeryFinishedLabStatus, VTS_I2) ON_EVENT(CLabResultsTabDlg, IDC_LAB_STATUS, 16, CLabResultsTabDlg::OnSelChosenLabStatus, VTS_DISPATCH) ON_EVENT(CLabResultsTabDlg, IDC_RESULTS_TREE, 2, CLabResultsTabDlg::OnSelChangedResultsTree, VTS_DISPATCH VTS_DISPATCH) ON_EVENT(CLabResultsTabDlg, IDC_RESULTS_TREE, 1, CLabResultsTabDlg::OnSelChangingResultsTree, VTS_DISPATCH VTS_PDISPATCH) ON_EVENT(CLabResultsTabDlg, IDC_RESULTS_TREE, 6, CLabResultsTabDlg::OnRButtonDownResultsTree, VTS_DISPATCH VTS_I2 VTS_I4 VTS_I4 VTS_I4) ON_EVENT(CLabResultsTabDlg, IDC_PDF_PREVIEW, 270, CLabResultsTabDlg::OnFileDownloadPdfPreview, VTS_BOOL VTS_PBOOL) ON_EVENT(CLabResultsTabDlg, IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST, 18, CLabResultsTabDlg::RequeryFinishedClinicalDiagnosisOptionsList, VTS_I2) END_EVENTSINK_MAP() void CLabResultsTabDlg::OnAddDiagnosis() { // (c.haag 2007-03-16 09:03) - PLID 21622 - Choose diagnoses from a multi-select list // (j.jones 2007-07-19 16:20) - PLID 26751 - the diagnosis description is now free-form text, // so we now just append to the end try { // Have the user choose diagnosis codes to add. The "Convert(nvarchar(1000)" statement was // carried over from the legacy code; the description field is an ntext type // (j.armen 2012-06-20 15:23) - PLID 49607 - Provide MultiSelect Sizing ConfigRT Entry CMultiSelectDlg dlg(this, "DiagCodes"); // (z.manning 2008-10-28 11:43) - PLID 24630 - We can now link diag codes to lab diagnoses, // so if we have a link, include the diag code in the text in the multi select dialog. CString strFrom = "LabDiagnosisT LEFT JOIN DiagCodes ON LabDiagnosisT.DiagID = DiagCodes.ID"; CString strValueField = "CASE WHEN DiagCodes.CodeNumber IS NOT NULL THEN DiagCodes.CodeNumber + ' - ' ELSE '' END + convert(nvarchar(1000), LabDiagnosisT.Description)"; if (IDOK != dlg.Open(strFrom, "", "LabDiagnosisT.ID", strValueField, "Please choose one or more diagnoses", 1)) return; // Now get a list of all the ID's which the user selected std::set<long> arIDs; CString strSelectIDs = dlg.GetMultiSelectIDString(","); dlg.FillArrayWithIDs(arIDs); Nx::SafeArray<long> sa(arIDs.size(), begin(arIDs), end(arIDs)); CString strCurDescription = ""; GetDlgItemText(IDC_LAB_DIAG_DESCRIPTION, strCurDescription); // (b.spivey February 24, 2016) - PLID 68371 - one api function call CString strMicroscopic; GetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, strMicroscopic); bool bLoadMicroscopicDescriptions = (GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->IsWindowVisible()) ? true:false; // (b.spivey February 22, 2016) - PLID 68371 - get the diagnosis description and result comments, and other microscopic stuff in the near future. NexTech_Accessor::_AddDiagnosisToInterfaceResultPtr diagPtr = GetAPI()->AddDiagnosisToLabInterface(GetAPISubkey(), GetAPILoginToken(), sa, _bstr_t(strCurDescription), _bstr_t(strMicroscopic), bLoadMicroscopicDescriptions); strCurDescription = (const char*)diagPtr->DiagnosisDescription; CString strAutoFillComment = (const char*)diagPtr->ResultComment; if (!strAutoFillComment.IsEmpty()) { CString str; GetDlgItemText(IDC_RESULT_COMMENTS, str); if (!str.IsEmpty() && AfxMessageBox("There are result comments linked to the diagnoses you selected and there are already result comments. " "Would you like to replace the existing result comments with the linked comments?", MB_ICONQUESTION | MB_YESNO) == IDNO) { //this is the case where we don't do anything. } else { SetDlgItemText(IDC_RESULT_COMMENTS, strAutoFillComment); } } //now update our description SetDlgItemText(IDC_LAB_DIAG_DESCRIPTION, strCurDescription); if (GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->IsWindowVisible()) { // get values from accessor pointer CString strMicro = (const char*)diagPtr->PromptMicroscopicDescription; NexTech_Accessor::_NullableIntPtr pNullableMicroID = diagPtr->PromptMicroscopicDescriptionID; bool bPromptForCommonMicroscopic = strMicro.IsEmpty() ? false : true; Nx::SafeArray<long> saClinicalDiagIDs(diagPtr->ClinicalDiagnosisIDs); // make clean variables from accessor output long nMicroID = VarLong(pNullableMicroID->GetValue(), -1); std::set<long> arClinicalDiagIDs(saClinicalDiagIDs.begin(), saClinicalDiagIDs.end()); bool bHasDiagnosisLinkedToClinicalDiagnosis = !arClinicalDiagIDs.empty(); bool bHasExactlyOneLinkedClinicalDiagnosis = arClinicalDiagIDs.size() == 1; if (bPromptForCommonMicroscopic) { if (IDYES == MsgBox(MB_YESNO, "Recent lab results with the Diagnosis '%s' have frequently had the " "following Microscopic Description:\r\n\r\n" "%s\r\n\r\n" "Would you like to use that value for this result's Microscopic Description field?", strCurDescription, strMicro)) { // (r.goldschmidt 2016-02-19 10:32) - PLID 68266 - When choosing a final diagnosis, if the preference to prompt for microscopic description is on and the user chooses yes on the prompt, append the microscopic description from the prompt to all lab diagnosis that they chose if (pNullableMicroID->IsNull() == VARIANT_FALSE) { // if it isn't null AddLabClinicalDiagnosisLink(arIDs, nMicroID); } SetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, strMicro); } } // (r.goldschmidt 2016-02-18 18:08) - PLID 68267 - Filter the microscopic description list for any linked descriptions that are linked with the final lab diagnoses that the user chose if (bHasDiagnosisLinkedToClinicalDiagnosis) { // (r.goldschmidt 2016-02-22 16:59) - PLID 68240 - If the final diagnosis code has only 1 linked microscopic description, automatically use it without prompting. if (bHasExactlyOneLinkedClinicalDiagnosis) { //lookup the description from the datalist std::set<long>::iterator itValue = arClinicalDiagIDs.begin(); long nValuetoFind = *itValue; NXDATALIST2Lib::IRowSettingsPtr pRow = m_pClinicalDiagOptionsList->FindByColumn(cdolcID, nValuetoFind, NULL, FALSE); if (strMicroscopic.IsEmpty()) { if (pRow) { strMicroscopic = VarString(pRow->GetValue(cdolcDesc)); } } else { if (pRow) { strMicroscopic += "\r\n" + VarString(pRow->GetValue(cdolcDesc)); } } SetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, strMicroscopic); RemoveFilterClinicalDiagnosisOptionsList(); } else { FilterClinicalDiagnosisOptionsList(arClinicalDiagIDs); } } // if none are linked, make sure to repopulate the list if previously filtered else { RemoveFilterClinicalDiagnosisOptionsList(); } } //(e.lally 2009-09-22) PLID 35609 - We have unsaved result changes m_bResultIsSaved = FALSE; } NxCatchAll("Error in CLabResultsTabDlg::OnAddDiagnosis()"); } // (s.dhole 2010-10-21 15:57) - PLID 36938 get new file name from database CString CLabResultsTabDlg::GetDocumentName(long nMailID) { _RecordsetPtr rsMailSent = CreateParamRecordset("SELECT PathName FROM mailsent WHERE mailid = {INT}", nMailID); if(!rsMailSent->eof) { //TES 2/2/2010 - PLID 34336 - Got it, fill the text. return AdoFldString(rsMailSent, "PathName", ""); } else { return ""; } } void CLabResultsTabDlg::OnSelChosenClinicalDiagnosisOptionsList(LPDISPATCH lpRow) { // (j.jones 2007-07-19 16:30) - PLID 26751 - the clinical diagnosis description is now free-form text, // so we now just append to the end try { IRowSettingsPtr pSelRow(lpRow); if(pSelRow != NULL) { // (r.goldschmidt 2016-02-18 18:46) - PLID 68268 - <show all> was clicked, remove filtering if (VarLong(pSelRow->GetValue(cdolcID)) == -1) { RemoveFilterClinicalDiagnosisOptionsList(); } else { CString strCurDescription; GetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, strCurDescription); CString strNewDesc = VarString(pSelRow->GetValue(cdolcDesc), "");; if (!strCurDescription.IsEmpty()) strCurDescription += "\r\n"; strCurDescription += strNewDesc; //now update our description SetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, strCurDescription); //(e.lally 2009-09-22) PLID 35609 - We have unsaved result changes m_bResultIsSaved = FALSE; } } } NxCatchAll("Error in CLabResultsTab::OnSelChosenClinicalDiagnosisOptionsList()"); } BOOL CLabResultsTabDlg::OnCommand(WPARAM wParam, LPARAM lParam) { try { // (j.jones 2007-07-19 16:34) - PLID 26751 - no commands are used currently, // as I removed the diagnosis/clinical diag lists // (j.gruber 2008-09-18 11:58) - PLID 31332 - new results interface switch(HIWORD(wParam)) { case EN_CHANGE: { //TES 11/22/2009 - PLID 36191 - We need to determine which LabResultField to look up in the tree.. int nFieldID = -1; switch((LOWORD(wParam))) { case IDC_RESULT_NAME: nFieldID = lrfName; break; case IDC_RESULT_LOINC: nFieldID = lrfLOINC; // (a.walling 2010-01-18 10:39) - PLID 36936 break; case IDC_SLIDE_NUMBER: nFieldID = lrfSlideNum; break; case IDC_LAB_DIAG_DESCRIPTION: nFieldID = lrfDiagnosis; break; case IDC_CLINICAL_DIAGNOSIS_DESC: nFieldID = lrfMicroscopicDescription; break; case IDC_RESULT_VALUE: nFieldID = lrfValue; break; // (c.haag 2009-05-06 14:46) - PLID 33789 case IDC_RESULT_UNITS: nFieldID = lrfUnits; break; case IDC_RESULT_REFERENCE: nFieldID = lrfReference; break; // (z.manning 2009-04-30 16:38) - PLID 28560 case IDC_RESULT_COMMENTS: nFieldID = lrfComments; break; case IDC_DATE_RECEIVED: HandleDateReceivedChange(); return 0; break; default: break; } if (nFieldID != -1) { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if (pRow) { CString strCurVal, strListVal; GetDlgItemText(LOWORD(wParam), strCurVal); strListVal = VarString(GetTreeValue(pRow, (LabResultField)nFieldID, lrtcValue),""); if (strCurVal != strListVal) { //(e.lally 2009-09-22) PLID 35609 - We have unsaved result changes m_bResultIsSaved = FALSE; } } } } break; } } NxCatchAll("Error in CLabResultsTabDlg::OnCommand"); return CNxDialog::OnCommand(wParam, lParam); } void CLabResultsTabDlg::OnEditFlag() { try{ CEditLabResultsDlg dlg(this); //Temporarily save the current selection for later IRowSettingsPtr pRow = m_pFlagCombo->GetCurSel(); // (j.gruber 2007-08-06 08:58) - PLID 26771 - took out varValue and replaced with nValue long nValue = -1; //TES 2/2/2010 - PLID 34336 - Remember the name as well. CString strValue; if(pRow != NULL) { nValue = VarLong(pRow->GetValue(lfcFlagID), -1); strValue = VarString(pRow->GetValue(lfcName),""); // (j.jones 2007-07-20 12:13) - PLID 26749 - set the // current anatomy ID, if we have one if(nValue > 0) dlg.m_nCurResultIDInUse = nValue; } else { if(m_pFlagCombo->IsComboBoxTextInUse) { //TES 2/2/2010 - PLID 34336 - It must be an inactive flag, in which case the ID will be in the tree, and the name is // the combo box text. nValue = VarLong(GetTreeValue(m_pResultsTree->CurSel, lrfFlag, lrtcForeignKeyID),-1); strValue = CString((LPCTSTR)m_pFlagCombo->ComboBoxText); } } dlg.DoModal(); m_pFlagCombo->Requery(); //Set the selection back to what it was // (b.cardillo 2008-06-27 16:17) - PLID 30529 - Changed to using the new temporary trysetsel method long nResult = m_pFlagCombo->TrySetSelByColumn_Deprecated(lfcFlagID, nValue); if(nResult == sriNoRow) { //TES 2/2/2010 - PLID 34336 - This flag may be inactive now, so just set the text. if(nValue != -1) { m_pFlagCombo->PutComboBoxText(_bstr_t(strValue)); } } else if(nResult == sriNoRowYet_WillFireEvent) { //TES 2/2/2010 - PLID 34336 - Let the user know what's happening. m_pFlagCombo->PutComboBoxText("Loading Flag..."); } }NxCatchAll("Error in CLabResultsTabDlg::OnEditFlag()"); } void CLabResultsTabDlg::OnEditLabDiagnoses() { try{ // (z.manning 2008-10-28 11:17) - PLID 24630 - We now have a dialog for this CLabEditDiagnosisDlg dlg(this); dlg.DoModal(); // (j.jones 2007-07-19 16:37) - PLID 26751 - converted diag list to free-form text, // so updating it is no longer needed }NxCatchAll("Error in CLabResultsTabDlg::OnEditLabDiagnoses()"); } void CLabResultsTabDlg::OnEditClinicalDiagnosisList() { try{ _variant_t varValue; IRowSettingsPtr pRow = m_pClinicalDiagOptionsList->GetCurSel(); if (pRow != NULL) varValue = pRow->GetValue(cdolcID); //(e.lally 2009-08-10) PLID 31811 - Renamed Dissection to Description // (j.armen 2012-06-06 15:51) - PLID 49856 - Refactored CEditComboBox CEditComboBox(this, 15, m_pClinicalDiagOptionsList, "Edit Microscopic Description List").DoModal(); // (j.jones 2007-07-19 16:37) - PLID 26751 - converted diag list to free-form text, // so updating it is no longer needed }NxCatchAll("Error in CLabResultsTabDlg::OnEditClinicalDiagnosisList"); } void CLabResultsTabDlg::OnTrySetSelFinishedLabFlag(long nRowEnum, long nFlags) { try{ if(nFlags == dlTrySetSelFinishedFailure) { //TES 2/2/2010 - PLID 34336 - It may be inactive, look it up in data (pull the ID from the tree, we make sure it's always up to date). long nFlagID = VarLong(GetTreeValue(m_pResultsTree->CurSel, lrfFlag, lrtcForeignKeyID),-1); _RecordsetPtr rsFlag = CreateParamRecordset("SELECT Name FROM LabResultFlagsT WHERE ID = {INT}", nFlagID); if(!rsFlag->eof) { //TES 2/2/2010 - PLID 34336 - Got it, fill the text. m_pFlagCombo->PutComboBoxText(_bstr_t(AdoFldString(rsFlag, "Name", ""))); } else { //TES 2/2/2010 - PLID 34336 - Else if it failed to load anything, check if we need to clear the combo box text if(m_pFlagCombo->GetIsComboBoxTextInUse() != FALSE) m_pFlagCombo->PutComboBoxText(""); } } }NxCatchAll("Error in CLabResultsTabDlg::OnTrySetSelFinishedLabFlag()"); } BOOL CLabResultsTabDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { try { CPoint pt; GetCursorPos(&pt); ScreenToClient(&pt); // (a.walling 2010-01-18 11:22) - PLID 36936 CRect rcLOINC; m_nxlabelLOINC.GetWindowRect(rcLOINC); ScreenToClient(&rcLOINC); // (j.jones 2013-10-18 09:46) - PLID 58979 - added patient education link CRect rcPatEducation; m_nxlabelPatientEducation.GetWindowRect(rcPatEducation); ScreenToClient(&rcPatEducation); bool bShowPatientEducationLink = (GetRemotePropertyInt("ShowPatientEducationLinks", 0, 0, GetCurrentUserName()) ? true : false); if ((rcLOINC.PtInRect(pt) && m_nxlabelLOINC.GetType() == dtsHyperlink) // (r.gonet 2014-01-27 15:29) - PLID 59339 - Only if we are in the pat edu link and we are showing it as a link.... || (bShowPatientEducationLink && rcPatEducation.PtInRect(pt) && m_nxlabelPatientEducation.GetType() == dtsHyperlink)) { SetCursor(GetLinkCursor()); return TRUE; } NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if (pRow) { long nMailID = VarLong(GetTreeValue(pRow, lrfValue, lrtcForeignKeyID), -1); if (nMailID != -1) { CRect rc; GetDlgItem(IDC_DOC_PATH_LINK)->GetWindowRect(rc); ScreenToClient(&rc); if (rc.PtInRect(pt)) { SetCursor(GetLinkCursor()); return TRUE; } } } }NxCatchAllIgnore(); return CNxDialog::OnSetCursor(pWnd, nHitTest, message); } LRESULT CLabResultsTabDlg::OnLabelClick(WPARAM wParam, LPARAM lParam) { try { // (c.haag 2011-02-23) - PLID 41618 - Special handling when in the attachments view if(m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { return m_pLabResultsAttachmentView->OnLabelClick(wParam, lParam); } else { ThrowNxException("Called CLabResultsTabDlg::OnLabelClick without a valid attachment view!"); } } UINT nIdc = (UINT)wParam; switch(nIdc) { case IDC_DOC_PATH_LINK: //open the file // (c.haag 2011-02-23) - PLID 41618 - We now pass in the current row ZoomAttachment(m_strCurrentFileName); break; case IDC_RESULT_LOINC_LABEL: // (a.walling 2010-01-18 15:20) - PLID 36955 - Popup the LOINC code editor/selector { CString strExistName, strExistCode; GetDlgItemText(IDC_RESULT_NAME, strExistName); GetDlgItemText(IDC_RESULT_LOINC, strExistCode); // (j.armen 2012-06-06 15:51) - PLID 49856 - Refactored CEditComboBox CEditComboBox dlg(this, 71, "Select or Edit LOINC Codes"); if (!strExistCode.IsEmpty()) { dlg.m_varInitialSel = _variant_t(strExistCode); } if (IDOK == dlg.DoModal()) { if (dlg.m_nLastSelID != -1) { _RecordsetPtr prsLOINC = CreateParamRecordset("SELECT Code, ShortName FROM LabLOINCT WHERE ID = {INT}", dlg.m_nLastSelID); if (!prsLOINC->eof) { CString strCode = AdoFldString(prsLOINC, "Code"); CString strName = AdoFldString(prsLOINC, "ShortName"); if (strCode != strExistCode || strName != strExistName) { if (!strExistName.IsEmpty() || !strExistCode.IsEmpty()) { CString strExistFormatName; if (strExistCode.IsEmpty()) { strExistFormatName.Format("%s", strExistName); } else { strExistFormatName.Format("%s (%s)", strExistName, strExistCode); } CString strFormatName; if (strCode.IsEmpty()) { strFormatName.Format("%s", strName); } else { strFormatName.Format("%s (%s)", strName, strCode); } if (IDNO == MessageBox(FormatString("Are you sure you want to replace the current result:\r\n\r\n%s\r\n\r\nwith:\r\n\r\n%s?", strExistFormatName, strFormatName), NULL, MB_YESNO | MB_ICONQUESTION)) { return 0; } } SetDlgItemText(IDC_RESULT_NAME, strName); SetDlgItemText(IDC_RESULT_LOINC, strCode); m_bResultIsSaved = FALSE; } } } } } return 0; break; // (j.jones 2013-10-18 11:39) - PLID 58979 - added patient education link case IDC_PT_EDUCATION_LABEL: { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if(pRow == NULL || pRow->GetValue(lrtcResultID).vt == VT_NULL) { MessageBox("Patient Education cannot be loaded because no lab result has been selected.", "Practice", MB_ICONINFORMATION|MB_OK); return 0; } //force a save if(!SaveResult(pRow)) { return 0; } if(!m_pLabEntryDlg->Save()){ return 0; } long nLabResultID = VarLong(pRow->GetValue(lrtcResultID), -1); if(nLabResultID == -1) { //should not be possible, because we forced a save ASSERT(FALSE); ThrowNxException("No valid lab result ID was found."); } // (r.gonet 10/30/2013) - PLID 58980 - The patient education hyperlink goes to the Medline Plus website LookupMedlinePlusInformationViaSearch(this, mlpLabResultID, nLabResultID); break; } default: //What? Some strange NxLabel is posting messages to us? ASSERT(FALSE); break; } } NxCatchAll(__FUNCTION__); return 0; } // (j.gruber 2008-10-27 16:39) - PLID 31332 BOOL CLabResultsTabDlg::CheckResultSave(BOOL bSilent) { if (! m_bResultIsSaved) { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if (pRow) { if (!bSilent) { if (IDYES == MsgBox(MB_YESNO, "The changes you made to this result are not saved yet, do you want to save them now? \nNote: If you save now, you can still undo the changes by clicking the cancel button for the entire lab.")) { return SaveResult(pRow); } } else { //just save quietly return SaveResult(pRow); } } } return TRUE; } void CLabResultsTabDlg::OnAddResult() { try { //since this will change the current selection, warn them if they want to save if (!CheckResultSave(FALSE)) { return; } //TES 11/22/2009 - PLID 36191 - Call our utility function. AddResult(); }NxCatchAll("Error in CLabResultsTabDlg::OnAddResult()"); } void CLabResultsTabDlg::AddResult() { //TES 11/30/2009 - PLID 36452 - If we don't have a lab selected, we can't add a result, as we won't know what to add it to. IRowSettingsPtr pCurSel = m_pResultsTree->CurSel; if(pCurSel == NULL) { return; } IRowSettingsPtr pLabRow = GetLabRow(pCurSel); //TES 11/22/2009 - PLID 36191 - Go through and add a row for every field, all blank and invisible for now, but they all need to be there. IRowSettingsPtr pParentRow = GetNewResultsTreeRow(); //TES 11/22/2009 - PLID 36191 - First, add the parent row, which is also the Name field. pParentRow->PutValue(lrtcResultID, (long)-1); pParentRow->PutValue(lrtcFieldID, (long)lrfName); pParentRow->PutValue(lrtcFieldName, _bstr_t("Name")); pParentRow->PutValue(lrtcValue, _bstr_t("")); pParentRow->PutValue(lrtcForeignKeyID, g_cvarNull); //TES 9/10/2013 - PLID 58511 - Result rows now check this field pParentRow->PutValue(lrtcExtraValue, g_cvarFalse); //TES 11/22/2009 - PLID 36191 - Add it at the beginning. //TES 11/30/2009 - PLID 36452 - Make it the first child of this lab. IRowSettingsPtr pFirstChild = pLabRow->GetFirstChildRow(); if(pFirstChild) { m_pResultsTree->AddRowBefore(pParentRow, pFirstChild); } else { m_pResultsTree->AddRowAtEnd(pParentRow, pLabRow); } //TES 11/22/2009 - PLID 36191 - Now add each of the other fields as child rows. //TES 4/28/2011 - PLID 43426 - Date Received By Lab IRowSettingsPtr pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfDateReceivedByLab); pRow->PutValue(lrtcFieldName, _bstr_t("Date Rec'd (Lab)")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Date Received pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfDateReceived); pRow->PutValue(lrtcFieldName, _bstr_t("Date Rec'd")); //TES 11/22/2009 - PLID 36191 - Go ahead and initialize this field to the current date. pRow->PutValue(lrtcValue, _variant_t(FormatDateTimeForInterface(COleDateTime::GetCurrentTime(), NULL, dtoDate, false))); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (a.walling 2010-02-25 15:46) - PLID 37546 - Date performed pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfDatePerformed); pRow->PutValue(lrtcFieldName, _bstr_t("Date Perf'd")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (a.walling 2010-01-18 10:17) - PLID 36936 - LOINC code pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfLOINC); pRow->PutValue(lrtcFieldName, _bstr_t("LOINC")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Value pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfValue); pRow->PutValue(lrtcFieldName, _bstr_t("Value")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Slide # pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSlideNum); pRow->PutValue(lrtcFieldName, _bstr_t("Slide #")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Diagnosis pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfDiagnosis); pRow->PutValue(lrtcFieldName, _bstr_t("Diagnosis")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Microscopic Description pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfMicroscopicDescription); pRow->PutValue(lrtcFieldName, _bstr_t("Microscopic Desc.")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Flag pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfFlag); pRow->PutValue(lrtcFieldName, _bstr_t("Flag")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Status pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfStatus); pRow->PutValue(lrtcFieldName, _bstr_t("Status")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Reference pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfReference); pRow->PutValue(lrtcFieldName, _bstr_t("Reference")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Units pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfUnits); pRow->PutValue(lrtcFieldName, _bstr_t("Units")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Comments pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfComments); pRow->PutValue(lrtcFieldName, _bstr_t("Comments")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Acknowledged By pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfAcknowledgedBy); pRow->PutValue(lrtcFieldName, _bstr_t("Acknowledged By")); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); //Acknowledged On pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfAcknowledgedOn); pRow->PutValue(lrtcFieldName, _bstr_t("Acknowledged On")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-09 17:23) - PLID 57937 Specimen Identifier pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenIdentifier); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Identifier")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-09 17:23) - PLID 57937 Specimen ID Text pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenIdText); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen ID Text")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-09 17:23) - PLID 57937 Specimen Start Time pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenStartTime); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Collection Start Time")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-09 17:23) - PLID 57937 Specimen End Time pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenEndTime); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Collection End Time")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-09 17:23) - PLID 57937 Specimen Reject Reason pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenRejectReason); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Reject Reason")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-09 17:23) - PLID 57937 Specimen Condition pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfSpecimenCondition); pRow->PutValue(lrtcFieldName, _bstr_t("Specimen Condition")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-16 17:32) - PLID 57600 - show Collection Start Time pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfServiceStartTime); pRow->PutValue(lrtcFieldName, _bstr_t("Lab Service Start Time")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-07-16 17:32) - PLID 57600 - show Collection End Time pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfServiceEndTime); pRow->PutValue(lrtcFieldName, _bstr_t("Lab Service End Time")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-08-07 16:09) - PLID 57912 - need to show the Performing Provider on report view of labresult tab dlg pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerformingProvider); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Provider")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerformingLab); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Name")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfObservationDate); pRow->PutValue(lrtcFieldName, _bstr_t("Observation Date")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-06 14:50) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabAddress); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Address")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-06 14:50) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabCity); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab City")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-06 14:50) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabState); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab State")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-06 14:50) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabZip); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Zip")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-06 14:50) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabCountry); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Country")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); // (d.singleton 2013-11-06 14:50) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs pRow = GetNewResultsTreeRow(); pRow->PutValue(lrtcResultID, (long)-1); pRow->PutValue(lrtcFieldID, (long)lrfPerfLabParish); pRow->PutValue(lrtcFieldName, _bstr_t("Performing Lab Parish")); pRow->PutValue(lrtcValue, g_cvarNull); pRow->PutValue(lrtcForeignKeyID, g_cvarNull); pRow->PutVisible(VARIANT_FALSE); m_pResultsTree->AddRowAtEnd(pRow, pParentRow); pParentRow->PutExpanded(VARIANT_TRUE); m_pResultsTree->CurSel = pParentRow; //TES 11/22/2009 - PLID 36191 - Now show the new result LoadResult(pParentRow); } void CLabResultsTabDlg::OnDeleteResult() { try { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if (pRow) { //TES 11/30/2009 - PLID 36452 - Are we actually on a result? IRowSettingsPtr pResultRow = GetResultRow(pRow); if(!pResultRow) { return; } if (IDNO == MsgBox(MB_YESNO, "Are you sure you want to delete this result?")) { return; } //TES 12/2/2009 - PLID 36191 - We need to de-map any attached files. // (c.haag 2011-01-07) - PLID 42047 - Fixed incorrect usage. I want to note // that m_strCurrentFileName is not updated here. TryDisplayOldestAttachedFile() // takes care of that later on. //m_mapAttachedFiles.RemoveKey((LPDISPATCH)pResultRow); { CMap<LPDISPATCH,LPDISPATCH,CString,CString&>* pMap; if(m_mapAttachedFiles.Lookup(pResultRow->GetParentRow(), pMap)) { if (NULL != pMap) { pMap->RemoveKey((LPDISPATCH)pResultRow); } } } //see what the ID is long nResultID = VarLong(pRow->GetValue(lrtcResultID)); if (nResultID == -1) { //its not saved to data, so just remove it //TES 11/22/2009 - PLID 36191 - Remove the parent row. m_pResultsTree->RemoveRow(pResultRow); //clear the cur sel m_pResultsTree->CurSel = NULL; //hide the rsults LoadResult(NULL); } else { long nMailID = VarLong(GetTreeValue(pRow, lrfValue, lrtcForeignKeyID), -1); if (nMailID > 0) { //it has a document attached MsgBox("This result has a document attached, this document will not be detached from the history tab"); m_aryDetachedDocs.Add(nResultID); } //they want to do it, mark this for deletion m_aryDeleteResults.Add(nResultID); //TES 11/22/2009 - PLID 36191 - Remove the parent row m_pResultsTree->RemoveRow(pResultRow); //clear the cur sel m_pResultsTree->CurSel = NULL; //hide the rsults LoadResult(NULL); } } }NxCatchAll("Error in CLabResultsTabDlg::OnDeleteResult()"); } // (j.gruber 2008-10-27 16:39) - PLID 31332 // (c.haag 2011-02-22) - PLID 42589 - All calls to showing/hiding or enabling/disabling windows have been moved to UpdateControlStates void CLabResultsTabDlg::LoadResult(NXDATALIST2Lib::IRowSettingsPtr pRow) { try { COleDateTime dtInvalid; dtInvalid.SetStatus(COleDateTime::invalid); //TES 11/20/2009 - PLID 36191 - We allow NULL to be passed in here now. //TES 11/30/2009 - PLID 36452 - Also make sure this has a result ID (meaning it's not a top-level Lab row) if(pRow == NULL || pRow->GetValue(lrtcResultID).vt == VT_NULL) { SetDlgItemText(IDC_RESULT_NAME, ""); SetDlgItemText(IDC_RESULT_LOINC, ""); // (a.walling 2010-01-18 10:39) - PLID 36936 // (a.walling 2010-01-18 11:18) - PLID 36936 m_dtpDateReceived.SetValue(m_varCurDate); m_dtpDateReceived.SetValue(COleVariant()); SetDlgItemText(IDC_SLIDE_NUMBER, ""); SetDlgItemText(IDC_LAB_DIAG_DESCRIPTION, ""); SetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, ""); SetDlgItemText(IDC_RESULT_VALUE, ""); SetDlgItemText(IDC_RESULT_UNITS, ""); SetDlgItemText(IDC_RESULT_REFERENCE, ""); SetDlgItemText(IDC_RESULT_COMMENTS, ""); // (c.haag 2010-12-29 09:18) - Don't show the controls if they're supposed to be hidden SetDlgItemText(IDC_RESULT_VALUE, ""); SetDlgItemText(IDC_RESULT_UNITS, ""); m_pFlagCombo->CurSel = NULL; m_pStatusCombo->CurSel = NULL; // (j.jones 2013-11-08 15:30) - PLID 58979 - disable Pt. Education m_btnPatientEducation.EnableWindow(FALSE); // (r.gonet 2014-01-27 15:29) - PLID 59339 - If we are showing it as a link, fine, but otherwise it is a label (or hidden elsewhere) bool bShowPatientEducationLink = (GetRemotePropertyInt("ShowPatientEducationLinks", 0, 0, GetCurrentUserName()) ? true : false); m_nxlabelPatientEducation.SetType(bShowPatientEducationLink ? dtsDisabledHyperlink : dtsDisabledText); m_nxlabelPatientEducation.AskParentToRedrawWindow(); if(pRow == NULL) { // (z.manning 2010-11-09 17:22) - PLID 41395 - We always want to display the attached PDF // if there's only one in the entire lab. TryDisplayOldestAttachedFile(); } else { //TES 2/3/2010 - PLID 36862 - We're on a top-level row, go ahead and load the first attached file for this specimen (if any). CString strAttachedFile; CMap<LPDISPATCH,LPDISPATCH,CString,CString&> *pMap = NULL; if(m_mapAttachedFiles.Lookup(pRow, pMap)) { POSITION pos = pMap->GetStartPosition(); if(pos) { LPDISPATCH pKey; pMap->GetNextAssoc(pos, pKey, strAttachedFile); } } if(!strAttachedFile.IsEmpty()) { //TES 11/23/2009 - PLID 36192 - Yes! Navigate to it. CString strFileName = strAttachedFile; if(strFileName.Find("\\") == -1) { strFileName = GetPatientDocumentPath(m_nPatientID) ^ strFileName; } //TES 2/3/2010 - PLID 37191 - Remember the attached file. m_strCurrentFileName = strFileName; //TES 11/23/2009 - PLID 36192 - If this is a .pdf file, we want to append #toolbar=0, to hide the .pdf controls. if(strFileName.Right(4).CompareNoCase(".pdf") == 0) { strFileName += "#toolbar=0"; } COleVariant varUrl(strFileName); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(TRUE); //TES 2/3/2010 - PLID 37191 - Enable the Zoom button. m_btnZoom.EnableWindow(TRUE); } else { // (z.manning 2010-11-09 17:22) - PLID 41395 - We always want to display the attached PDF // if there's only one in the entire lab. TryDisplayOldestAttachedFile(); } } } else { IRowSettingsPtr pParent = GetResultRow(pRow); SetDlgItemText(IDC_RESULT_NAME, VarString(pParent->GetValue(lrtcValue), "")); _variant_t var = GetTreeValue(pRow, lrfDateReceived, lrtcValue); if (var.vt == VT_DATE) { COleDateTime dt = VarDateTime(var); if (dt.GetStatus() == COleDateTime::valid) { m_dtpDateReceived.SetValue(dt); } else { m_dtpDateReceived.SetValue(m_varCurDate); //but we want it unchecked m_dtpDateReceived.SetValue(COleVariant()); } } else if (var.vt == VT_BSTR) { COleDateTime dtReceived; if (VarString(var, "").IsEmpty()) { m_dtpDateReceived.SetValue(m_varCurDate); //but we want it unchecked m_dtpDateReceived.SetValue(COleVariant()); } else { dtReceived.ParseDateTime(VarString(var, "")); if (dtReceived.GetStatus() == COleDateTime::valid) { m_dtpDateReceived.SetValue(dtReceived); } else { //set it to be today unchecked m_dtpDateReceived.SetValue(m_varCurDate); m_dtpDateReceived.SetValue(COleVariant()); } } } else { //set it to the current time m_dtpDateReceived.SetValue(m_varCurDate); //but we want it unchecked m_dtpDateReceived.SetValue(COleVariant()); } // (j.jones 2013-11-08 15:30) - PLID 58979 - enable Pt. Education m_btnPatientEducation.EnableWindow(TRUE); // (r.gonet 2014-01-27 15:29) - PLID 59339 - If we are showing it as a link, fine, but otherwise it is a label (or hidden elsewhere) bool bShowPatientEducationLink = (GetRemotePropertyInt("ShowPatientEducationLinks", 0, 0, GetCurrentUserName()) ? true : false); m_nxlabelPatientEducation.SetType(bShowPatientEducationLink ? dtsHyperlink : dtsText); m_nxlabelPatientEducation.AskParentToRedrawWindow(); // (a.walling 2010-01-18 11:18) - PLID 36936 - Update the hyperlink state if necessary if (m_nxlabelLOINC.GetType() != dtsHyperlink) { m_nxlabelLOINC.SetType(dtsHyperlink); m_nxlabelLOINC.AskParentToRedrawWindow(); } _variant_t varLOINC = GetTreeValue(pRow, lrfLOINC, lrtcValue); if (varLOINC.vt == VT_BSTR) { SetDlgItemText(IDC_RESULT_LOINC, VarString(varLOINC)); } else { SetDlgItemText(IDC_RESULT_LOINC, ""); } // (r.galicki 2008-10-21 13:04) - PLID 31552 - Handle hidden columns if(m_ltType == ltBiopsy) { // (r.galicki 2008-10-17 14:50) - PLID 31552 _variant_t varValue = GetTreeValue(pRow, lrfSlideNum, lrtcValue); if(VT_BSTR == varValue.vt) { SetDlgItemText(IDC_SLIDE_NUMBER, VarString(varValue, "")); } //TES 3/10/2009 - PLID 33433 - Even if the value is blank, we still need to update the edit box! else { SetDlgItemText(IDC_SLIDE_NUMBER, ""); } } SetDlgItemText(IDC_LAB_DIAG_DESCRIPTION, VarString(GetTreeValue(pRow, lrfDiagnosis, lrtcValue), "")); if(m_ltType == ltBiopsy) { // (r.galicki 2008-10-17 14:55) - PLID 31552 // (c.haag 2010-12-29 09:18) - Don't show the controls if they're supposed to be hidden _variant_t varValue = GetTreeValue(pRow, lrfMicroscopicDescription, lrtcValue); // (r.galicki 2008-10-21 13:00) - PLID 31552 if(VT_BSTR == varValue.vt) { SetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, VarString(varValue, "")); } //TES 3/10/2009 - PLID 33433 - Even if the value is blank, we still need to update the edit box! else { SetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, ""); } // (b.spivey, August 27, 2013) - PLID 46295 - Show anatomical location on the discrete/report views. CString strAnatomicalLocation = GetAnatomicalLocationAsString(GetCurrentLab()); m_nxstaticAnatomicalLocationTextDiscrete.SetWindowTextA(strAnatomicalLocation); m_nxstaticAnatomicalLocationTextReport.SetWindowTextA(strAnatomicalLocation); // (r.goldschmidt 2016-02-25 17:05) - PLID 68267 - remove the filter on the clinical diagnosis drop down RemoveFilterClinicalDiagnosisOptionsList(); } long nMailID = VarLong(GetTreeValue(pRow, lrfValue, lrtcForeignKeyID),-1); if (nMailID == -1) { SetDlgItemText(IDC_RESULT_VALUE, VarString(GetTreeValue(pRow, lrfValue, lrtcValue), "")); } SetDlgItemText(IDC_RESULT_UNITS, VarString(GetTreeValue(pRow, lrfUnits, lrtcValue), "")); // (c.haag 2009-05-06 14:53) - PLID 33789 SetDlgItemText(IDC_RESULT_REFERENCE, VarString(GetTreeValue(pRow, lrfReference, lrtcValue), "")); SetDlgItemText(IDC_RESULT_COMMENTS, VarString(GetTreeValue(pRow, lrfComments, lrtcValue), "")); long nFlagID = VarLong(GetTreeValue(pRow, lrfFlag, lrtcForeignKeyID),-1); long nResult = m_pFlagCombo->TrySetSelByColumn_Deprecated(lfcFlagID, nFlagID); if(nResult == sriNoRow) { //TES 2/2/2010 - PLID 34336 - If it's inactive, look up the name and fill the combo box text. if(nFlagID != -1) { _RecordsetPtr rsFlag = CreateParamRecordset("SELECT Name FROM LabResultFlagsT WHERE ID = {INT}", nFlagID); m_pFlagCombo->PutComboBoxText(_bstr_t(AdoFldString(rsFlag, "Name",""))); } } else if(nResult == sriNoRowYet_WillFireEvent) { //TES 2/2/2010 - PLID 34336 - Let the user know what's happening. m_pFlagCombo->PutComboBoxText("Loading Flag..."); } //TES 12/1/2008 - PLID 32191 - Added a field for Status m_pStatusCombo->SetSelByColumn(lscStatusID, GetTreeValue(pRow, lrfStatus, lrtcForeignKeyID)); //TES 11/23/2009 - PLID 36192 - Does this result have a file attached? CString strAttachedFile; //TES 1/27/2010 - PLID 36862 - Get all files for the current requisition CMap<LPDISPATCH,LPDISPATCH,CString,CString&> *pMap = NULL; if(GetAttachedFiles(pParent, pMap)) { //TES 1/27/2010 - PLID 36862 - Now, use the file attached to this specific result, if any; otherwise just pull the first // attached file. if(!pMap->Lookup(pParent, strAttachedFile)) { POSITION pos = pMap->GetStartPosition(); if(pos) { LPDISPATCH pKey; pMap->GetNextAssoc(pos, pKey, strAttachedFile); } } if(!strAttachedFile.IsEmpty()) { //TES 11/23/2009 - PLID 36192 - Yes! Navigate to it. CString strFileName = strAttachedFile; if(strFileName.Find("\\") == -1) { strFileName = GetPatientDocumentPath(m_nPatientID) ^ strFileName; } //TES 2/3/2010 - PLID 37191 - Remember which file we're previewing. m_strCurrentFileName = strFileName; //TES 11/23/2009 - PLID 36192 - If this is a .pdf file, we want to append #toolbar=0, to hide the .pdf controls. if(strFileName.Right(4).CompareNoCase(".pdf") == 0) { strFileName += "#toolbar=0"; } COleVariant varUrl(strFileName); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(TRUE); //TES 2/3/2010 - PLID 37191 - Enable the Zoom button UpdateZoomButton(); } else { // (z.manning 2010-11-09 17:22) - PLID 41395 - We always want to display the attached PDF // if there's only one in the entire lab. TryDisplayOldestAttachedFile(); } } else { // (z.manning 2010-11-09 17:22) - PLID 41395 - We always want to display the attached PDF // if there's only one in the entire lab. TryDisplayOldestAttachedFile(); } } // (c.haag 2010-12-01 11:45) - PLID 37372 - Signature fields IRowSettingsPtr pParent = GetResultRow(pRow); if (NULL == pParent) { // If we don't have a result row selected, it may be the case that a lab row is selected and it has a single // result. Try to assign that as our parent. pParent = GetFirstAndOnlyLabResultRow(pRow); } // (c.haag 2010-12-10 9:45) - PLID 40556 - Update the acknowledged button text // (c.haag 2011-02-21) - PLID 41618 - Pass in the active result FormatAcknowledgedButtonText(pRow); // (f.gelderloos 2013-08-28 15:51) - PLID 57826 FormatAcknowledgeAndSignButtonText(pRow); // (c.haag 2010-12-01 11:57) - PLID 37372 - Update the signature button text // (c.haag 2011-02-21) - PLID 41618 - Pass in the active result FormatSignButtonText(pRow); // (c.haag 2010-12-02 10:28) - PLID 38633 - Update the mark completed button text // (c.haag 2011-02-21) - PLID 41618 - Pass in the active result FormatMarkCompletedButtonText(pRow); FormatMarkAllCompleteButtonText(pRow); // (j.luckoski 3-21-13) PLID 55424 - Format button // (c.haag 2010-12-06 13:48) - PLID 41618 - Update the scroll buttons UpdateScrollButtons(); // (c.haag 2011-02-23) - PLID 41618 - Update the detach/attach button UpdateDetachButton(); // (j.dinatale 2010-12-27) - PLID 41591 - Format buttons based on the row passed in FormatNotesButtons(pRow); // (c.haag 2011-02-22) - PLID 42589 - Update control visibilities and enabled/disabled states UpdateControlStates(m_bControlsHidden, pRow); m_bResultIsSaved = TRUE; }NxCatchAll("Error in CLabResultsTabDlg::LoadResult"); } // (j.gruber 2008-10-27 16:39) - PLID 31332 BOOL CLabResultsTabDlg::SaveResult(NXDATALIST2Lib::IRowSettingsPtr pRow) { try { //TES 11/30/2009 - PLID 36452 - Make sure we're on a row, and that it's tied to a result. if(pRow == NULL || VarLong(pRow->GetValue(lrtcFieldID)) == (long)lrfLabName) { return TRUE; } // (c.haag 2009-05-06 15:08) - PLID 33789 - Added 'Units' // (a.walling 2010-01-18 10:41) - PLID 36936 - Added LOINC CString strName, strSlideNum, strDiagnosis, strMicroDesc, strValue, strUnits, strReference, strFlag, strResultComments, strLOINC; long nFlagID; COleDateTime dtReceived; GetDlgItemText(IDC_RESULT_NAME, strName); _variant_t varReceived = m_dtpDateReceived.GetValue(); BOOL bUseDate = FALSE; if (varReceived.vt == VT_DATE) { COleDateTime dt = m_dtpDateReceived.GetDateTime(); if (dt.GetStatus() == COleDateTime::valid) { dtReceived = dt; bUseDate = TRUE; } else { bUseDate = FALSE; } } else if (varReceived.vt == VT_NULL) { bUseDate = FALSE; } // (a.walling 2010-01-18 10:42) - PLID 36936 GetDlgItemText(IDC_RESULT_LOINC, strLOINC); GetDlgItemText(IDC_SLIDE_NUMBER, strSlideNum); GetDlgItemText(IDC_LAB_DIAG_DESCRIPTION, strDiagnosis); GetDlgItemText(IDC_CLINICAL_DIAGNOSIS_DESC, strMicroDesc); GetDlgItemText(IDC_RESULT_VALUE, strValue); GetDlgItemText(IDC_RESULT_UNITS, strUnits); // (c.haag 2009-05-06 15:09) - PLID 33789 GetDlgItemText(IDC_RESULT_REFERENCE, strReference); // (z.manning 2009-04-30 16:59) - PLID 28560 - Added result comments GetDlgItemText(IDC_RESULT_COMMENTS, strResultComments); NXDATALIST2Lib::IRowSettingsPtr pFlagRow = m_pFlagCombo->CurSel; if (pFlagRow) { nFlagID = VarLong(pFlagRow->GetValue(lfcFlagID), -1); strFlag = VarString(pFlagRow->GetValue(lfcName), ""); } else { //TES 2/2/2010 - PLID 34336 - It may be inactive, in which case we'll pull from the tree and ComboBoxText. if(!m_pFlagCombo->IsComboBoxTextInUse) { nFlagID = -1; strFlag = ""; } else { //(e.lally 2010-05-13) PLID 38629 - We want the long value here to avoid a type mismatch exception. nFlagID = VarLong(GetTreeValue(pRow, lrfFlag, lrtcForeignKeyID),-1); strFlag = CString((LPCTSTR)m_pFlagCombo->ComboBoxText); } } COleDateTime dtCurDate; //get the stored server date for comparison if(m_varCurDate.vt != VT_NULL) dtCurDate = VarDateTime(m_varCurDate); else{ //The member variable was not set! ASSERT(FALSE); //We can just use the local time dtCurDate = COleDateTime::GetCurrentTime(); } //Date Received if(m_dtpDateReceived.GetValue().vt != VT_NULL){ //We just want to compare the date part in case the time got saved too. COleDateTime dtTemp, dtRecVal; dtTemp = VarDateTime(m_dtpDateReceived.GetValue()); dtRecVal.SetDate(dtTemp.GetYear(), dtTemp.GetMonth(), dtTemp.GetDay()); if(dtRecVal > dtCurDate){ MessageBox("You cannot have a Date Received that is in the future."); return FALSE; } if (dtRecVal.GetStatus() != COleDateTime::valid) { MessageBox("Please enter a valid Date Received."); return FALSE; } } //Slide Number if(strSlideNum.GetLength() > 25){ MessageBox("The Slide Number entered is longer than 25 characters. " "Please shorten it before saving."); GetDlgItem(IDC_SLIDE_NUMBER)->SetFocus(); return FALSE; } //Result Name if(strName.GetLength() > 255){ MessageBox("The Result Name entered is longer than 255 characters. " "Please shorten it before saving."); GetDlgItem(IDC_RESULT_NAME)->SetFocus(); return FALSE; } //Reference if(strReference.GetLength() > 255){ MessageBox("The Result Reference entered is longer than 255 characters. " "Please shorten it before saving."); GetDlgItem(IDC_RESULT_REFERENCE)->SetFocus(); return FALSE; } // (r.gonet 06/24/2014) - PLID 61685 - Removed check for > 255 on Result Comments because the field is now NVARCHAR(MAX). //TES 12/1/2008 - PLID 32191 - Pull the Status field long nStatusID; CString strStatus; NXDATALIST2Lib::IRowSettingsPtr pStatusRow = m_pStatusCombo->CurSel; if (pStatusRow) { nStatusID = VarLong(pStatusRow->GetValue(lscStatusID), -1); strStatus = VarString(pStatusRow->GetValue(lscDescription), ""); } else { nStatusID = -1; strStatus = ""; } SetTreeValue(pRow, lrfName, lrtcValue, _variant_t(strName)); if (bUseDate) { //TES 12/1/2008 - PLID 32281 - Put the actual date value in there, not a string representation (which, // incidentally, was stripping out the time). SetTreeValue(pRow, lrfDateReceived, lrtcValue, _variant_t(dtReceived, VT_DATE)); } else { SetTreeValue(pRow, lrfDateReceived, lrtcValue, _variant_t("")); } // (a.walling 2010-01-18 10:42) - PLID 36936 SetTreeValue(pRow, lrfLOINC, lrtcValue, strLOINC.IsEmpty() ? g_cvarNull : _variant_t(strLOINC)); SetTreeValue(pRow, lrfSlideNum, lrtcValue, _variant_t(strSlideNum)); SetTreeValue(pRow, lrfFlag, lrtcForeignKeyID, (long)nFlagID); SetTreeValue(pRow, lrfFlag, lrtcValue, _variant_t(strFlag)); SetTreeValue(pRow, lrfDiagnosis, lrtcValue, _variant_t(strDiagnosis)); SetTreeValue(pRow, lrfMicroscopicDescription, lrtcValue, _variant_t(strMicroDesc)); if(VarLong(GetTreeValue(pRow, lrfValue, lrtcForeignKeyID),-1) == -1) { SetTreeValue(pRow, lrfValue, lrtcValue, _variant_t(strValue)); } SetTreeValue(pRow, lrfUnits, lrtcValue, _variant_t(strUnits)); // (c.haag 2009-05-06 14:53) - PLID 33789 SetTreeValue(pRow, lrfReference, lrtcValue, _variant_t(strReference)); //TES 12/1/2008 - PLID 32191 - Added columns for the Status field SetTreeValue(pRow, lrfStatus, lrtcForeignKeyID, nStatusID); SetTreeValue(pRow, lrfStatus, lrtcValue, _variant_t(strStatus)); // (z.manning 2009-04-30 16:59) - PLID 28560 - Added result comments SetTreeValue(pRow, lrfComments, lrtcValue, _variant_t(strResultComments)); //Don't fill mailID or DocPath here since they are handled with the attach and detach buttons //m_btnSaveResultChanges.EnableWindow(FALSE); //m_btnCancelResultChanges.EnableWindow(FALSE); m_bResultIsSaved = TRUE; return TRUE; }NxCatchAll("Error in CLabResultsTabDlg::SaveResult()"); return FALSE; } void CLabResultsTabDlg::OnDateTimeChangedDateReceived(NMHDR *pNMHDR, LRESULT *pResult) { try { HandleDateReceivedChange(); }NxCatchAll("Error in CLabEntryDlg::OnDatetimechangeDateReceived"); *pResult = 0; } // (j.gruber 2008-10-27 16:38) - PLID 31332 void CLabResultsTabDlg::HandleDateReceivedChange() { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if (pRow) { COleDateTime dtColVal, dtCurVal; CString strColVal, strCurVal; _variant_t varDateReceived = GetTreeValue(pRow, lrfDateReceived, lrtcValue); if (varDateReceived.vt == VT_DATE) { dtColVal = VarDateTime(varDateReceived); if (dtColVal.GetStatus() == COleDateTime::valid) { strColVal = FormatDateTimeForSql(dtColVal, dtoDate); } else { strColVal = ""; } } else if (varDateReceived.vt == VT_BSTR) { if (VarString(varDateReceived, "").IsEmpty()) { strColVal = ""; } else { dtColVal.ParseDateTime(VarString(varDateReceived, "")); if (dtColVal.GetStatus() == COleDateTime::valid) { strColVal = FormatDateTimeForSql(dtColVal); } else { strColVal = ""; } } } dtCurVal = m_dtpDateReceived.GetValue(); if (m_dtpDateReceived.GetValue().vt == VT_NULL) { strCurVal = ""; } else { if (dtCurVal.GetStatus() == COleDateTime::valid) { strCurVal = FormatDateTimeForSql(dtCurVal, dtoDate); } else { strCurVal = ""; } } if (strColVal != strCurVal) { //(e.lally 2009-09-22) PLID 35609 - We have unsaved result changes m_bResultIsSaved = FALSE; } } } void CLabResultsTabDlg::OnSelChosenLabFlag(LPDISPATCH lpRow) { try { NXDATALIST2Lib::IRowSettingsPtr pRow(lpRow); long nNewFlagID; CString strNewFlag; //TES 8/6/2013 - PLID 51147 - Need to pull the Todo Priority as well _variant_t varNewTodoPriority = g_cvarNull; if (pRow) { nNewFlagID = VarLong(pRow->GetValue(lfcFlagID)); strNewFlag = VarString(pRow->GetValue(lfcName)); varNewTodoPriority = pRow->GetValue(lfcTodoPriority); } else { nNewFlagID = -1; } pRow = m_pResultsTree->CurSel; long nCurrentFlagID; if (pRow) { nCurrentFlagID = VarLong(GetTreeValue(pRow, lrfFlag, lrtcForeignKeyID),-1); } if (nNewFlagID != nCurrentFlagID) { //(e.lally 2009-09-22) PLID 35609 - We have unsaved result changes m_bResultIsSaved = FALSE; } //TES 2/2/2010 - PLID 34336 - We need to set this value in the tree right away, so we can look it up in there for inactive flags. SetTreeValue(pRow, lrfFlag, lrtcForeignKeyID, nNewFlagID); SetTreeValue(pRow, lrfFlag, lrtcValue, _bstr_t(strNewFlag)); //TES 8/6/2013 - PLID 51147 - Save the new Todo Priority to the tree SetTreeValue(pRow, lrfFlag, lrtcExtraValue, varNewTodoPriority); }NxCatchAll("Error in CLabResultsTabDlg::OnSelChosenLabFlag()"); } void CLabResultsTabDlg::OnRequeryFinishedLabFlag(short nFlags) { try{ IRowSettingsPtr pRow = m_pFlagCombo->GetNewRow(); pRow->PutValue(lfcFlagID, (long)-1); pRow->PutValue(lfcName, "< No Flag >"); m_pFlagCombo->AddRowBefore(pRow, m_pFlagCombo->GetFirstRow()); }NxCatchAll("Error in CLabResultsTabDlg::OnRequeryFinishedLabFlag()"); } void CLabResultsTabDlg::OnAttachFile() { try { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; IRowSettingsPtr pParent = GetResultRow(pRow); //Make sure we actually have a row selected if(pRow != NULL && pParent != NULL) { // (b.spivey, July 11, 2013) - PLID 45194 - Menu options to scan as image/pdf/multipagepdf. CMenu submenu; submenu.CreatePopupMenu(); submenu.AppendMenu(MF_ENABLED|MF_BYPOSITION, ID_SCAN_PDF, "Scan as PDF..."); submenu.AppendMenu(MF_ENABLED|MF_BYPOSITION, ID_SCAN_MULTIPDF, "Scan as Multi-Page PDF..."); submenu.AppendMenu(MF_BYPOSITION|MF_SEPARATOR); submenu.AppendMenu(MF_ENABLED|MF_BYPOSITION, ID_SCAN_IMAGE, "Scan as Image..."); // (j.dinatale 2013-03-04 12:38) - PLID 34339 - context menu here CMenu mnu; mnu.CreatePopupMenu(); mnu.AppendMenu(MF_ENABLED|MF_BYPOSITION, 1, "&Existing File From History..."); mnu.AppendMenu(MF_ENABLED|MF_BYPOSITION, 2, "&New File..."); // (b.spivey, July 10, 2013) - PLID 45194 - Insert the menu created earlier. mnu.InsertMenu(3, MF_BYPOSITION|MF_POPUP, (UINT_PTR)submenu.GetSafeHmenu(), "Import from &Scanner"); CRect rButton; GetDlgItem(IDC_ATTACH_FILE)->GetWindowRect(rButton); int nSelection = mnu.TrackPopupMenu(TPM_LEFTALIGN|TPM_RETURNCMD|TPM_TOPALIGN, rButton.right, rButton.top, this); switch(nSelection){ case 1: // attach existing AttachExistingFile(pRow, pParent); break; case 2: // attach new AttachNewFile(pRow, pParent); break; case 0: // nothing selected break; case ID_SCAN_IMAGE: DoTWAINAcquisition(NXTWAINlib::eScanToImage); break; case ID_SCAN_PDF: DoTWAINAcquisition(NXTWAINlib::eScanToPDF); break; case ID_SCAN_MULTIPDF: DoTWAINAcquisition(NXTWAINlib::eScanToMultiPDF); break; default: ThrowNxException("CLabResultsTabDlg::OnAttachFile() - Invalid Menu Option!"); } } }NxCatchAll("Error in CLabResultsTabDlg::OnAttachFile()"); } void CLabResultsTabDlg::OnDetachFile() { try { // (c.haag 2011-02-22) - PLID 41618 - Use different behavior based on what view we are in if (m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnDetachFile(); } else { ThrowNxException("Called CLabResultsTabDlg::OnDetachFile without a valid attachment view!"); } } else { // (c.haag 2011-02-22) - PLID 41618 - We now track the attachment row here DetachFile(GetResultRow(m_pResultsTree->CurSel)); } } NxCatchAll("Error in CLabResultsTabDlg::OnDetachFile()"); } // (c.haag 2011-02-22) - PLID 41618 - Self-contained function for detaching files. void CLabResultsTabDlg::DetachFile(IRowSettingsPtr pRow) { //get the mailID IRowSettingsPtr pParent = GetResultRow(pRow); if (pRow != NULL && pParent != NULL) { pRow = m_pResultsTree->FindByColumn(lrtcFieldID, (long)lrfValue, pParent, VARIANT_FALSE); ASSERT(pRow->GetParentRow() == pParent); long nMailID = VarLong(pRow->GetValue(lrtcForeignKeyID), -1); long nResultID = VarLong(pRow->GetValue(lrtcResultID), -1); //they shouldn't be ablt the click the detach button without a document attached or going to be attached ASSERT(nMailID != -1); if (nMailID == -2) { //they've added this document without saving to the database //so just reset everything } else { if (IDNO == MsgBox(MB_YESNO, "Are you sure you want to detach this file from this result?")) { return; } m_aryDetachedDocs.Add(nResultID); } pRow->PutValue(lrtcValue, _variant_t("")); SetTreeValue(pRow, lrfUnits, lrtcValue, _variant_t("")); // (c.haag 2009-05-06 14:54) - PLID 33789 pRow->PutValue(lrtcForeignKeyID, (long)-1); SetDlgItemText(IDC_DOC_PATH_LINK, ""); SetDlgItemText(IDC_RESULT_VALUE, ""); SetDlgItemText(IDC_RESULT_UNITS, ""); //TES 11/23/2009 - PLID 36192 - Remember that there is no file attached to this row. //TES 2/3/2010 - PLID 36862 - Look up in our new, two-level map. CMap<LPDISPATCH,LPDISPATCH,CString,CString&>* pMap; if(m_mapAttachedFiles.Lookup(pParent->GetParentRow(), pMap)) { //TES 2/8/2010 - PLID 36862 - Check if the file being detached is the one we're currently previewing it, and if so, // remember that we aren't previewing it any more. CString strFileName; pMap->Lookup(pParent, strFileName); if(strFileName == m_strCurrentFileName) { m_strCurrentFileName = ""; } pMap->RemoveKey((LPDISPATCH)pParent); } //TES 11/23/2009 - PLID 36192 - Go ahead and re-load the result, this will update the browser and other controls. SaveResult(pRow); LoadResult(pRow); } } void CLabResultsTabDlg::OnRequeryFinishedLabStatus(short nFlags) { try { //TES 11/28/2008 - PLID 32191 - Add a <None> row. IRowSettingsPtr pRow = m_pStatusCombo->GetNewRow(); pRow->PutValue(lscStatusID, (long)-1); pRow->PutValue(lscDescription, ""); m_pStatusCombo->AddRowBefore(pRow, m_pStatusCombo->GetFirstRow()); }NxCatchAll("Error in CLabResultsTabDlg::OnRequeryFinishedLabStatus()"); } void CLabResultsTabDlg::OnEditResultStatus() { try{ CEditLabStatusDlg dlg(this); //TES 12/4/2008 - PLID 32191 - Temporarily save the current selection for later IRowSettingsPtr pRow = m_pStatusCombo->GetCurSel(); long nValue = -1; if(pRow != NULL) { nValue = VarLong(pRow->GetValue(lscStatusID), -1); } //TES 12/4/2008 - PLID 32191 - Bring up the dialog. dlg.DoModal(); //TES 12/4/2008 - PLID 32191 - Refresh the list, now that it's probably changed. m_pStatusCombo->Requery(); //TES 12/4/2008 - PLID 32191 - Set the selection back to what it was m_pStatusCombo->SetSelByColumn(lscStatusID, nValue); }NxCatchAll("Error in CLabResultsTabDlg::OnEditResultStatus()"); } void CLabResultsTabDlg::OnSelChosenLabStatus(LPDISPATCH lpRow) { try { //TES 12/1/2008 - PLID 32191 - Added a status field, track when the user changes the selection. NXDATALIST2Lib::IRowSettingsPtr pRow(lpRow); long nNewStatusID; if (pRow) { nNewStatusID = VarLong(pRow->GetValue(lscStatusID)); } else { nNewStatusID = -1; } pRow = m_pResultsTree->CurSel; long nCurrentStatusID; if (pRow) { nCurrentStatusID = VarLong(GetTreeValue(pRow, lrfStatus, lrtcForeignKeyID),-1); } if (nNewStatusID != nCurrentStatusID) { //(e.lally 2009-09-22) PLID 35609 - We have unsaved result changes m_bResultIsSaved = FALSE; } }NxCatchAll("Error in CLabResultsTabDlg::OnSelChosenLabStatus()"); } void CLabResultsTabDlg::SetCurrentDate(_variant_t varCurDate) { m_varCurDate = varCurDate; } //TES 11/22/2009 - PLID 36191 - Pulls the value from the tree that corresponds to the result represented by pRow, the field represented by lrf, // and the column represented by lrtc _variant_t CLabResultsTabDlg::GetTreeValue(NXDATALIST2Lib::IRowSettingsPtr pRow, LabResultField lrf, LabResultTreeColumns lrtc) { //TES 11/22/2009 - PLID 36191 - Make sure something's selected. if(pRow == NULL) { return g_cvarNull; } //TES 11/22/2009 - PLID 36191 - Pull the parent row for this result. //TES 11/30/2009 - PLID 36452 - This may be NULL, if we're on a Lab row. IRowSettingsPtr pResultParent = GetResultRow(pRow); if(pResultParent == NULL) { return g_cvarNull; } if(lrf == lrfName) { //TES 11/22/2009 - PLID 36191 - The name is the parent, so we've already got the right row. return pResultParent->GetValue(lrtc); } else { //TES 11/22/2009 - PLID 36191 - Find the row for this field pRow = m_pResultsTree->FindByColumn(lrtcFieldID, (long)lrf, pResultParent, VARIANT_FALSE); if(pRow == NULL || pRow->GetParentRow() != pResultParent) { //TES 11/22/2009 - PLID 36191 - That's impossible! Every LabResultField value should be a child of this parent! AfxThrowNxException(FormatString("Failed to find stored value for LabResultField %i!", lrf)); } //TES 11/22/2009 - PLID 36191 - Return the value. return pRow->GetValue(lrtc); } } //TES 11/22/2009 - PLID 36191 - Puts the given value into the tree, using the given column, and the row given by lrf that is for the same result // as pRow is for. void CLabResultsTabDlg::SetTreeValue(NXDATALIST2Lib::IRowSettingsPtr pRow, LabResultField lrf, LabResultTreeColumns lrtc, _variant_t varValue) { //TES 11/22/2009 - PLID 36191 - Make sure we have a row. if(pRow == NULL) { return; } //TES 11/30/2009 - PLID 36452 - Make sure that row is for a result (i.e., not a top-level Lab row). IRowSettingsPtr pResultParent = GetResultRow(pRow); if(pResultParent == NULL) { return; } if(lrf == lrfName) { //TES 11/22/2009 - PLID 36191 - the name is the parent, so we've already got the right row. pResultParent->PutValue(lrtc, varValue); } else { //TES 11/22/2009 - PLID 36191 - Find the row for this field pRow = m_pResultsTree->FindByColumn(lrtcFieldID, (long)lrf, pResultParent, VARIANT_FALSE); if(pRow == NULL || pRow->GetParentRow() != pResultParent) { //TES 11/22/2009 - PLID 36191 - That's impossible! Every LabResultField value should be a child of this parent! AfxThrowNxException(FormatString("Failed to find stored value for LabResultField %i!", lrf)); } //TES 11/22/2009 - PLID 36191 - Set the value. pRow->PutValue(lrtc, varValue); //TES 11/22/2009 - PLID 36191 - Now, if this is a non-empty value (and this isn't one of our always-hidden fields), make sure // that the row gets shown. if(varValue.vt != VT_NULL && lrf != lrfAcknowledgedBy && lrf != lrfAcknowledgedOn) { if((varValue.vt != VT_BSTR || VarString(varValue) != "") && (varValue.vt != VT_I4 || VarLong(varValue) != -1)) { pRow->Visible = VARIANT_TRUE; } } } } void CLabResultsTabDlg::OnSelChangedResultsTree(LPDISPATCH lpOldSel, LPDISPATCH lpNewSel) { try { NXDATALIST2Lib::IRowSettingsPtr pNewRow(lpNewSel); NXDATALIST2Lib::IRowSettingsPtr pOldRow(lpOldSel); //we already prompted to save if (pNewRow != pOldRow) { //TES 11/22/2009 - PLID 36191 - Show the newly selected result. LoadResult(pNewRow); if(pNewRow) { //TES 11/30/2009 - PLID 36452 - Tell our dialog to synchronize the Requisitions tab with the lab we currently have selected. IRowSettingsPtr pLabRow = GetLabRow(pNewRow); m_pLabEntryDlg->SetCurrentLab(VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1)); } } }NxCatchAll("Error in CLabResultsTabDlg::OnSelChangedResultsTree()"); } void CLabResultsTabDlg::OnSelChangingResultsTree(LPDISPATCH lpOldSel, LPDISPATCH* lppNewSel) { try { NXDATALIST2Lib::IRowSettingsPtr pOldRow(lpOldSel); //see if we need to prompt to save if (pOldRow != NULL && !m_bResultIsSaved) { if (!SaveResult(pOldRow)) { SafeSetCOMPointer(lppNewSel, lpOldSel); } } }NxCatchAll("Error in CLabResultsTabDlg::OnSelChangingResultsTree()"); } void CLabResultsTabDlg::OnRButtonDownResultsTree(LPDISPATCH lpRow, short nCol, long x, long y, long nFlags) { try { //TES 10/14/2008 - PLID 31637 - Just in case there's any information in the HL7 message that they need, allow // them to view the original message. This is basically just a fail-safe that will allow any office that finds // they are missing information to work around that while we get them a patch. IRowSettingsPtr pRow(lpRow); if(pRow == NULL) { return; } // (r.gonet 06/02/2014) - PLID 40426 - Find the corresponding lab row and see if the row they right clicked on is the lab row. bool bIsLabRow = true; NXDATALIST2Lib::IRowSettingsPtr pLabRow = pRow; NXDATALIST2Lib::IRowSettingsPtr pParentRow = NULL; while ((pParentRow = pLabRow->GetParentRow()) != NULL) { bIsLabRow = false; pLabRow = pParentRow; } // (r.gonet 06/02/2014) - PLID 40426 - Only show the context menu if we are either on a result row or on a lab row with results if ((bIsLabRow && pLabRow->GetFirstChildRow() != NULL) || !bIsLabRow) { // (r.gonet 06/02/2014) - PLID 40426 - Create a context menu CMenu pMenu; pMenu.CreatePopupMenu(); long nPosition = 0; // (r.gonet 06/02/2014) - PLID 40426 - Depending on what was clicked, change the wording slightly. if (!bIsLabRow) { pMenu.InsertMenu(nPosition++, MF_BYPOSITION, 1, "Move Lab Result"); } else { pMenu.InsertMenu(nPosition++, MF_BYPOSITION, 1, "Move Lab Results"); } //TES 10/14/2008 - PLID 31637 - Pull the message from the linked HL7MessageQueueT (if any). // (r.goldschmidt 2015-11-02 15:47) - PLID 66437 - Update everywhere in Practice that displays HL7 messages to handle purged messages // Don't bother adding an option to view HL7 messages, if they're not licensed for HL7 long nResultID = VarLong(pRow->GetValue(lrtcResultID), -1); _RecordsetPtr rsMessage = NULL; if (g_pLicense->CheckForLicense(CLicense::lcHL7, CLicense::cflrSilent)) { rsMessage = CreateRecordset("SELECT HL7MessageQueueT.ID " "FROM HL7MessageQueueT INNER JOIN LabResultsT ON HL7MessageQueueT.ID = LabResultsT.HL7MessageID " "WHERE LabResultsT.ResultID = %li", nResultID); if (!rsMessage->eof) { //TES 10/14/2008 - PLID 31637 - There is a message to view, so give them the option to view it. pMenu.InsertMenu(nPosition++, MF_BYPOSITION, 2, "View Original HL7 Message"); } } CPoint pt; GetCursorPos(&pt); int nReturn = pMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RETURNCMD, pt.x, pt.y, this); switch (nReturn) { case 1: { // (r.gonet 06/02/2014) - PLID 40426 - Move Lab Result(s) // We can't move a lab result record without permission to write if (!CheckCurrentUserPermissions(bioPatientLabs, sptDynamic4)) { return; } // we are going to force a save, we cannot have notes added to a lab and then the user hitting cancel if (!m_pLabEntryDlg->Save()) { return; } // (r.gonet 06/02/2014) - PLID 40426 - Grab the lab ID long nLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID), -1); CMovePatientLabsDlg dlg(this, m_nPatientID, nLabID, nResultID); if (IDOK == dlg.DoModal()) { if (GetInitialLabID() == -1) { // This entire requisition was unsaved. We need to have an initial lab order when loading existing SetInitialLabID(nLabID); } // Reload the lab tree LoadExisting(); } break; } case 2: { //TES 10/14/2008 - PLID 31637 - They chose to view it. Use CMsgBox so that the whole message will be // visible no matter how big it is. // (z.manning 2011-07-08 16:27) - PLID 38753 - We now have a function to show this // (r.goldschmidt 2015-11-02 15:48) - PLID 66437 - Update everywhere in Practice that displays HL7 messages to handle purged messages ViewHL7ImportMessage(AdoFldLong(rsMessage, "ID")); break; } } } else { // This is a lab row and it doesn't have results, so don't show the context menu. } }NxCatchAll("Error in CLabResultsTabDlg::OnRButtonDownResultsTree()"); } void CLabResultsTabDlg::OnFileDownloadPdfPreview(BOOL ActiveDocument, BOOL* Cancel) { try { if(!ActiveDocument) { //TES 11/23/2009 - PLID 36192 - If we get here, that means its about to pop up a dialog to download the file. We don't want // that, so set the Cancel parameter to TRUE to cancel that. We do want to go ahead and disable the browser, but if we do that // here, it won't actually work, we have to post a message to do it, we'll go ahead and just set a timer. SetTimer(IDT_DISABLE_BROWSER, 0, NULL); *Cancel = TRUE; } } NxCatchAll("Error in CLabResultsTabDlg::OnFileDownloadPdfPreview()"); } void CLabResultsTabDlg::OnTimer(UINT_PTR nIDEvent) { try { switch(nIDEvent) { case IDT_DISABLE_BROWSER: //TES 11/23/2009 - PLID 36192 - We've been asked to disable the browser, so go ahead and do that. KillTimer(IDT_DISABLE_BROWSER); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache //TES 1/16/2014 - PLID 59209 - If we get here, Adobe isn't installed properly, so explain that to the user, rather than leaving it blank. m_pBrowser->Navigate2(COleVariant("nxres://0/AdobeWarning.html"), COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(FALSE); //TES 2/4/2010 - PLID 37191 - Note that we are NOT disabling the Zoom button. If we get here, that means that // the attached file couldn't be previewed, but that's no reason to prevent them from opening it. break; } }NxCatchAll("Error in CLabResultsTabDlg::OnTimer()"); } void CLabResultsTabDlg::HandleSpecimenChange(long nLabID, const CString &strNewSpecimen) { //TES 11/30/2009 - PLID 36452 - One of the labs' specimens has changed, update our tree. IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); while(pLabRow) { long nID = VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1); if(nID == nLabID) { //TES 11/30/2009 - PLID 36452 - Found it! Calculate the new name. CString strNewName = m_pLabEntryDlg->GetFormNumber(); if(!strNewSpecimen.IsEmpty()) { strNewName += " - " + strNewSpecimen; } pLabRow->PutValue(lrtcValue, _bstr_t(strNewName)); //TES 11/30/2009 - PLID 36452 - Remember the specimen field separately, in case the form number changes. pLabRow->PutValue(lrtcSpecimen, _bstr_t(strNewSpecimen)); return; } pLabRow = pLabRow->GetNextRow(); } } // (c.haag 2010-11-18 17:35) - PLID 37372 - Returns the current lab ID long CLabResultsTabDlg::GetCurrentLab() const { //TES 11/30/2009 - PLID 36452 - Select a row corresponding to the given lab ID, if one isn't selected already. IRowSettingsPtr pCurSel = m_pResultsTree->CurSel; //TES 11/30/2009 - PLID 36452 - What's selected now? long nCurLabID = -2; if(pCurSel) { IRowSettingsPtr pLabRow = GetLabRow(pCurSel); nCurLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1); } return nCurLabID; } void CLabResultsTabDlg::SetCurrentLab(long nLabID) { //TES 11/30/2009 - PLID 36452 - Select a row corresponding to the given lab ID, if one isn't selected already. IRowSettingsPtr pCurSel = m_pResultsTree->CurSel; //TES 11/30/2009 - PLID 36452 - What's selected now? long nCurLabID = -2; if(pCurSel) { IRowSettingsPtr pLabRow = GetLabRow(pCurSel); nCurLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1); } if(nCurLabID != nLabID) { //TES 11/30/2009 - PLID 36452 - They differ, so find the row that corresponds to this ID (note that there can only ever be one with // an ID of -1), and select its first result, or the top-level row if it has no results. IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); while(pLabRow) { if(VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1) == nLabID) { if(pLabRow->GetFirstChildRow()) { m_pResultsTree->CurSel = pLabRow->GetFirstChildRow(); } else { m_pResultsTree->CurSel = pLabRow; } LoadResult(m_pResultsTree->CurSel); // (j.dinatale 2010-12-13) - PLID 41438 - only on the first time this is called, go ahead get the user's prefered view, // if its the pdf view and theres no files attached // shift the view over to report view since the pdf view will be blank. If this is not the first time we set the view, // go ahead and set it to the current view to work around the z-order issue // (k.messina 2011-11-16) - PLID 41438 - setting the default view to NexTech's report if(m_nCurrentView == rvNotSet){ long nPreferredView = GetRemotePropertyInt("LabResultUserView", (long)rvPDF, 0, GetCurrentUserName(), true); if(nPreferredView == rvPDF && m_mapAttachedFiles.IsEmpty()) nPreferredView = rvNexTechReport; SetCurrentResultsView(nPreferredView); }else{ SetCurrentResultsView(m_nCurrentView); } return; } pLabRow = pLabRow->GetNextRow(); } } } void CLabResultsTabDlg::HandleFormNumberChange(const CString &strFormNumber) { //TES 11/30/2009 - PLID 36452 - The form number has changed, so update all of our lab rows with this number, and their stored Specimen. IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); while(pLabRow) { CString strSpecimen = VarString(pLabRow->GetValue(lrtcSpecimen)); if(strSpecimen.IsEmpty()) { pLabRow->PutValue(lrtcValue, _bstr_t(strFormNumber)); } else { pLabRow->PutValue(lrtcValue, _bstr_t(strFormNumber + " - " + strSpecimen)); } pLabRow = pLabRow->GetNextRow(); } } IRowSettingsPtr CLabResultsTabDlg::GetResultRow(IRowSettingsPtr pRow) { //TES 11/30/2009 - PLID 36452 - Get the result-type row that matches this one (will be NULL if pRow is a top-level row). if(!pRow) { return NULL; } else { long nRowType = VarLong(pRow->GetValue(lrtcFieldID)); if(nRowType == (long)lrfLabName) { return NULL; } else if(nRowType == (long)lrfName) { return pRow; } else { return pRow->GetParentRow(); } } } IRowSettingsPtr CLabResultsTabDlg::GetLabRow(IRowSettingsPtr pRow) const { //TES 11/30/2009 - PLID 36452 - Get the top-level parent for this row. if(!pRow) { return NULL; } else { long nRowType = VarLong(pRow->GetValue(lrtcFieldID)); if(nRowType == (long)lrfLabName) { return pRow; } else if(nRowType == (long)lrfName) { return pRow->GetParentRow(); } else { return pRow->GetParentRow()->GetParentRow(); } } } // (c.haag 2010-11-18 16:08) - PLID 37372 - Returns the lab row given a lab ID IRowSettingsPtr CLabResultsTabDlg::GetLabRowByID(const long nLabID) const { IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); while (pLabRow) { if (VarLong(pLabRow->GetValue(lrtcForeignKeyID),-1) == nLabID) { return pLabRow; } pLabRow = pLabRow->GetNextRow(); } // The lab doesn't exist in the tree! return NULL; } //TES 1/27/2010 - PLID 36862 - Remember that the given file is attached to the given result. void CLabResultsTabDlg::SetAttachedFile(NXDATALIST2Lib::IRowSettingsPtr pResultRow, CString strFile) { //TES 1/27/2010 - PLID 36862 - Look up the result map in our requisition map. CMap<LPDISPATCH,LPDISPATCH,CString,CString&> *pMap = NULL; if(!m_mapAttachedFiles.Lookup((LPDISPATCH)pResultRow->GetParentRow(), pMap)) { //TES 1/27/2010 - PLID 36862 - It wasn't there, so we'll need a new one. pMap = new CMap<LPDISPATCH,LPDISPATCH,CString,CString&>; } //TES 1/27/2010 - PLID 36862 - Now, set the attached file in the result map. pMap->SetAt((LPDISPATCH)pResultRow, strFile); //TES 1/27/2010 - PLID 36862 - And put it back into the requisition map. m_mapAttachedFiles.SetAt((LPDISPATCH)pResultRow->GetParentRow(), pMap); } //TES 1/27/2010 - PLID 36862 - Get all result/file pairs for the requisition corresponding to the given result. BOOL CLabResultsTabDlg::GetAttachedFiles(NXDATALIST2Lib::IRowSettingsPtr pResultRow, OUT CMap<LPDISPATCH,LPDISPATCH,CString,CString&>* &pMap) { //TES 1/27/2010 - PLID 36862 - Just look it up in our map return m_mapAttachedFiles.Lookup((LPDISPATCH)pResultRow->GetParentRow(), pMap); } void CLabResultsTabDlg::OnZoom() { try { // (c.haag 2011-02-22) - PLID 41618 - Special handling when in the attachments view if (m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnZoom(); } else { ThrowNxException("Called CLabResultsTabDlg::OnZoom without a valid attachment view!"); } } else { ZoomAttachment(m_strCurrentFileName); } } NxCatchAll(__FUNCTION__); } // (c.haag 2011-02-22) - PLID 41618 - Self-contained function for zooming. I also added the MsgBox // call when I noted that OpenLabDoc had it when I deprecated it. void CLabResultsTabDlg::ZoomAttachment(const CString& strFilename) { //TES 2/3/2010 - PLID 37191 - Just open up whatever file we're currently previewing. if (!strFilename.IsEmpty()) { if (!OpenDocument(strFilename, m_nPatientID)) { MsgBox(RCS(IDS_NO_FILE_OPEN)); } } } // (z.manning 2010-04-29 12:41) - PLID 38420 void CLabResultsTabDlg::OnSize(UINT nType, int cx, int cy) { try { CNxDialog::OnSize(nType, cx, cy); SetControlPositions(); //TES 2/7/2012 - PLID 47996 - If we're in the Report View, reload our HTML, which is based on the size of the window. if(IsDlgButtonChecked(IDC_REPORTVIEW_RADIO)) { //TES 2/7/2012 - PLID 47996 - Find the currently selected specimen row. IRowSettingsPtr pRow = m_pResultsTree->CurSel; NXDATALIST2Lib::IRowSettingsPtr pSpecRow = NULL; if (pRow) { pSpecRow = GetSpecFromCurrentRow(pRow); if (pSpecRow) { //TES 2/7/2012 - PLID 47996 - Reload the HTML LoadHTMLReport(pSpecRow); } } } }NxCatchAll(__FUNCTION__); } // (z.manning 2010-05-12 10:42) - PLID 37400 - Returns a new row for the result tree with all values initialized to null IRowSettingsPtr CLabResultsTabDlg::GetNewResultsTreeRow() { IRowSettingsPtr pNewRow = m_pResultsTree->GetNewRow(); short nColCount = m_pResultsTree->GetColumnCount(); for(int nCol = 0; nCol < nColCount; nCol++) { pNewRow->PutValue(nCol, g_cvarNull); } return pNewRow; } // (z.manning 2010-05-12 11:08) - PLID 37400 void CLabResultsTabDlg::EnableResultWnd(BOOL bEnable, CWnd *pwnd) { // (z.manning 2010-05-12 11:13) - PLID 37400 - This function will enable or disable the given // CWnd except for edit controls in which case it will make them read-only. BOOL bIsEdit = pwnd->IsKindOf(RUNTIME_CLASS(CEdit)); if(bEnable) { pwnd->EnableWindow(TRUE); if(bIsEdit) { ((CEdit*)pwnd)->SetReadOnly(FALSE); } } else { if(bIsEdit) { pwnd->EnableWindow(TRUE); ((CEdit*)pwnd)->SetReadOnly(TRUE); } else { pwnd->EnableWindow(FALSE); } } } // (z.manning 2010-05-13 11:35) - PLID 37405 - Returns the currently active lab req dialog CLabRequisitionDlg* CLabResultsTabDlg::GetActiveLabRequisitionDlg() { IRowSettingsPtr pLabRow = GetLabRow(m_pResultsTree->GetCurSel()); if(pLabRow == NULL) { return NULL; } const long nLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID), -1); return m_pLabEntryDlg->GetLabRequisitionDlgByID(nLabID); } // (z.manning 2010-11-09 17:17) - PLID 41395 // (c.haag 2010-12-06 15:49) - PLID 41618 - Also get the MailID and result row void CLabResultsTabDlg::GetAllAttachedFiles(OUT CArray<CAttachedLabFile,CAttachedLabFile&> &aAttachedFiles) { aAttachedFiles.RemoveAll(); POSITION posMain = m_mapAttachedFiles.GetStartPosition(); while(posMain != NULL) { LPDISPATCH lpKey; CMap<LPDISPATCH,LPDISPATCH,CString,CString&>* pmapFiles; m_mapAttachedFiles.GetNextAssoc(posMain, lpKey, pmapFiles); POSITION posTemp = pmapFiles->GetStartPosition(); while(posTemp != NULL) { CString strFile; pmapFiles->GetNextAssoc(posTemp, lpKey, strFile); if(!strFile.IsEmpty()) { CAttachedLabFile alf; IRowSettingsPtr pResultRow(lpKey); alf.lpRow = lpKey; alf.nMailID = VarLong(GetTreeValue(pResultRow, lrfValue, lrtcForeignKeyID),-1); alf.strFileName = strFile; alf.dtAttached = VarDateTime(GetTreeValue(pResultRow, lrfValue, lrtcDate)); aAttachedFiles.Add(alf); } } } } // (c.haag 2010-12-28 13:41) - PLID 41618 - Returns all attached files sorted by MailID descending. // The first entry in this array is the oldest attachment. void CLabResultsTabDlg::GetAllAttachedFilesSorted(OUT CArray<CAttachedLabFile,CAttachedLabFile&> &aAttachedFiles) { GetAllAttachedFiles(aAttachedFiles); // Sort the attached files by MailID ascending. A value of -1 will be placed at the end because it is technically the // most recent attachment. qsort(aAttachedFiles.GetData(),aAttachedFiles.GetSize(),sizeof(CAttachedLabFile),CompareAttachedLabFile); } // (z.manning 2010-11-09 15:05) - PLID 41395 - This function will display the only attached file in the // entire lab (regardless of specimen) if there's exactly one file attached. void CLabResultsTabDlg::TryDisplayOldestAttachedFile() { // (c.haag 2011-02-23) - PLID 41618 - Changed the array type CArray<CAttachedLabFile,CAttachedLabFile&> aAttachedFiles; GetAllAttachedFiles(aAttachedFiles); if(aAttachedFiles.GetSize() == 1) { CString strFileName = aAttachedFiles.GetAt(0).strFileName; if(strFileName.Find("\\") == -1) { strFileName = GetPatientDocumentPath(m_nPatientID) ^ strFileName; } // (z.manning 2010-11-09 17:28) - PLID 41395 - No need to do this if it's the same file. if(strFileName != m_strCurrentFileName) { //TES 2/3/2010 - PLID 37191 - Remember the attached file. m_strCurrentFileName = strFileName; //TES 11/23/2009 - PLID 36192 - If this is a .pdf file, we want to append #toolbar=0, to hide the .pdf controls. if(strFileName.Right(4).CompareNoCase(".pdf") == 0) { strFileName += "#toolbar=0"; } COleVariant varUrl(strFileName); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(TRUE); //TES 2/3/2010 - PLID 37191 - Enable the Zoom button. // (c.haag 2011-02-23) - PLID 41618 - Use UpdateZoomButton UpdateZoomButton(); } } else { //TES 11/23/2009 - PLID 36192 - Nope, set our preview control to blank and disabled. COleVariant varUrl("about:blank"); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(FALSE); //TES 2/3/2010 - PLID 37191 - Remember that nothing's attached. m_strCurrentFileName = ""; //TES 2/3/2010 - PLID 37191 - Make sure the Zoom button is disabled. // (c.haag 2011-02-23) - PLID 41618 - Use UpdateZoomButton UpdateZoomButton(); } } // (c.haag 2011-02-22) - PLID 41618 - This function should be called when changing to // either the report or discrete values view. The attachments view has its own internal // way of handling these, and this function should never be called when the attachments // view is visible. void CLabResultsTabDlg::RefreshSharedControls(IRowSettingsPtr pActiveRow) { if (m_nCurrentView == rvPDF) { ThrowNxException("CLabResultsTabDlg::RefreshSharedControls was called from the attachments view!"); } // 1. Update the result label m_nxstaticLabResultLabel.SetWindowText("Results"); // 2. Update the detach/attach button UpdateDetachButton(); // 3. Update the scroll buttons UpdateScrollButtons(); // 4. Update the zoom button UpdateZoomButton(); // 5. Update the notes buttons // (j.dinatale 2010-12-27) - PLID 41591 - format the buttons accordingly FormatNotesButtons(pActiveRow); // 6. Update the acknowledged button text FormatAcknowledgedButtonText(pActiveRow); // 7. Update the signature button text FormatSignButtonText(pActiveRow); // 8. Update the mark completed button text FormatMarkCompletedButtonText(pActiveRow); FormatMarkAllCompleteButtonText(pActiveRow); // (j.luckoski 3-21-13) PLID 55424 - Format button FormatAcknowledgeAndSignButtonText(pActiveRow); // (f.gelderloos 2013-08-28 16:07) - PLID 57826 } // (k.messina 2011-11-11) - PLID 41438 - utilizes enumeration to select view from within code void CLabResultsTabDlg::SetCurrentResultsView(int nResultsView) { switch(nResultsView) { case rvPDF : SetUpPDFView(); break; case rvNexTechReport : SetUpReportView(); break; case rvDiscreteValues : SetUpDiscreteView(); break; } } // (j.dinatale 2010-12-14) - PLID 41438 - Utility function for PDF View void CLabResultsTabDlg::SetUpPDFView() { m_pLabResultsAttachmentView->Setup(); } // (k.messina 2011-11-11) - PLID 41438 - PDF view has been selected void CLabResultsTabDlg::OnBnClickedPdfviewRadio() { try{ // (c.haag 2011-02-25) - PLID 41618 - Do nothing if we're already in the view if (m_nCurrentView != rvPDF) { // (c.haag 2011-02-25) - PLID 41618 - Try to save the result first so the // view is updated SaveResult(m_pResultsTree->CurSel); // (j.dinatale 2010-12-14) - PLID 41438 - call the utility function for pdf view SetUpPDFView(); } } NxCatchAll("Error in CLabResultsTabDlg::OnBnClickedPdfviewRadio"); } // (j.dinatale 2010-12-14) - PLID 41438 - Utility function for setting up the report view void CLabResultsTabDlg::SetUpReportView() { try{ // (j.gruber 2010-11-30 09:14) - PLID 41606 - unload any previous reports UnloadHTMLReports(); //check the radio button if it isn't checked off if(!((CButton *)GetDlgItem(IDC_REPORTVIEW_RADIO))->GetCheck()) SetDlgItemCheck(IDC_REPORTVIEW_RADIO, TRUE); // (j.dinatale 2010-12-14) - PLID 41438 - ensure that the other radio buttons arent in their checked states if(((CButton *)GetDlgItem(IDC_DISCRETEVALUES_RADIO))->GetCheck()) SetDlgItemCheck(IDC_DISCRETEVALUES_RADIO, FALSE); if(((CButton *)GetDlgItem(IDC_REPORTVIEW_RADIO))->GetCheck()) SetDlgItemCheck(IDC_PDFVIEW_RADIO, FALSE); //hide everything // (c.haag 2011-02-22) - PLID 42589 - Pass in the current tree selection UpdateControlStates(true, m_pResultsTree->CurSel); // (j.gruber 2010-11-24 11:42) - PLID 41607 RefreshHTMLReportOnlyControls(TRUE); //enlarge the webviewer // (c.haag 2010-11-23 11:19) - PLID 37372 - Make it a little shorter // (a.walling 2011-04-29 08:26) - PLID 43501 - Don't mess with z-order or copying client bits SetSingleControlPos(IDC_PDF_PREVIEW, NULL, 5, 91, 945, 350, SWP_SHOWWINDOW|SWP_NOCOPYBITS|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_FRAMECHANGED); // (j.dinatale 2010-12-13) - PLID 41438 - No need to remember, the user will be able to setup their default view //set the ConfigRT to store the user's last view //SetRemotePropertyInt("LabResultUserView", (long)rvPDF, 0, GetCurrentUserName()); // (j.gruber 2010-11-30 09:14) - PLID 41606 - run the report //get the currently selected Specimen IRowSettingsPtr pRow = m_pResultsTree->CurSel; NXDATALIST2Lib::IRowSettingsPtr pSpecRow = NULL; if (pRow) { //save the result to update the tree SaveResult(pRow); pSpecRow = GetSpecFromCurrentRow(pRow); } else { //are there any rows pRow = m_pResultsTree->GetFirstRow(); if (pRow) { //set the current sel m_pResultsTree->CurSel = pRow; // (j.gruber 2011-02-21 10:00) - PLID 41606 - some fix ups for the buttons //save the result to update the tree //we don't need to save since we are selecting it //SaveResult(pRow); //we do need to load though LoadResult(pRow); pSpecRow = GetSpecFromCurrentRow(pRow); } } if (pSpecRow) { LoadHTMLReport(pSpecRow); } // (j.dinatale 2010-12-14) - PLID 41438 - until the z-order issue is fixed, we need to maintain the current view m_nCurrentView = rvNexTechReport; // (c.haag 2011-02-22) - PLID 41618 - The PDF view shares controls with the other views. We need to update // those controls now. RefreshSharedControls(pSpecRow); } NxCatchAll(__FUNCTION__); } // (k.messina 2011-11-11) - PLID 41438 - report view has been selected void CLabResultsTabDlg::OnBnClickedReportviewRadio() { try{ // (j.dinatale 2010-12-14) - PLID 41438 - call the utility function for the report view SetUpReportView(); } NxCatchAll("Error in CLabResultsTabDlg::OnBnClickedReportviewRadio"); } // (j.dinatale 2010-12-14) - PLID 41438 - Utility function to set up the discrete values view void CLabResultsTabDlg::SetUpDiscreteView() { try{ // (j.gruber 2010-11-30 09:14) - PLID 41606 - unload any previous reports UnloadHTMLReports(); //check the radio button if it isn't checked off if(!((CButton *)GetDlgItem(IDC_DISCRETEVALUES_RADIO))->GetCheck()) SetDlgItemCheck(IDC_DISCRETEVALUES_RADIO, TRUE); // (j.dinatale 2010-12-14) - PLID 41438 - ensure that the other radio buttons arent in their checked states if(((CButton *)GetDlgItem(IDC_PDFVIEW_RADIO))->GetCheck()) SetDlgItemCheck(IDC_PDFVIEW_RADIO, FALSE); if(((CButton *)GetDlgItem(IDC_REPORTVIEW_RADIO))->GetCheck()) SetDlgItemCheck(IDC_REPORTVIEW_RADIO, FALSE); //first show all the controls because the other views hide them // (c.haag 2011-02-22) - PLID 42589 - Pass in the current tree selection UpdateControlStates(false, m_pResultsTree->CurSel); // (j.gruber 2010-11-24 11:42) - PLID 41607 - needed for HTML Report controls RefreshHTMLReportOnlyControls(FALSE); //shrik the web viewer // (a.walling 2011-04-29 08:26) - PLID 43501 - Don't mess with z-order or copying client bits SetSingleControlPos(IDC_PDF_PREVIEW, NULL, 302, 90, 644, 145, SWP_SHOWWINDOW|SWP_NOCOPYBITS|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_FRAMECHANGED); //load the results for our current selection //LoadResult(m_pResultsTree->CurSel); // (j.gruber 2010-11-30 09:14) - PLID 41606 ReloadCurrentPDF(); // (j.dinatale 2010-12-13) - PLID 41438 - No need to remember, the user will be able to setup their default view //set the ConfigRT to store the user's last view //SetRemotePropertyInt("LabResultUserView", (long)rvPDF, 0, GetCurrentUserName()); // (j.dinatale 2010-12-14) - PLID 41438 - until the z-order issue is fixed, we need to maintain the current view m_nCurrentView = rvDiscreteValues; // (c.haag 2011-02-22) - PLID 41618 - The PDF view shares controls with the other views. We need to update // those controls now. RefreshSharedControls(m_pResultsTree->CurSel); }NxCatchAll(__FUNCTION__); } // (k.messina 2011-11-11) - PLID 41438 - descrete values view has been selected void CLabResultsTabDlg::OnBnClickedDiscretevaluesRadio() { try{ // (j.dinatale 2010-12-14) - PLID 41438 - call the utility function to set up discrete values SetUpDiscreteView(); } NxCatchAll("Error in CLabResultsTabDlg::OnBnClickedDiscretevaluesRadio"); } // (k.messina 2011-11-11) - PLID 41438 - consolidating the logic to hide controls // (c.haag 2011-02-22) - PLID 42589 - Renamed to UpdateControlStates and we now take in the current selection void CLabResultsTabDlg::UpdateControlStates(bool bHideControls, IRowSettingsPtr pCurTreeSel) { //assume we are hiding the controls for preparation of expanding the web browser int nToggleHide = SW_HIDE; //check if we are not hiding them if(!bHideControls) nToggleHide = SW_SHOW; // (c.haag 2010-12-06 13:37) - PLID 41618 BOOL bInReportView = ((CButton *)GetDlgItem(IDC_REPORTVIEW_RADIO))->GetCheck(); BOOL bInPDFView = ((CButton *)GetDlgItem(IDC_PDFVIEW_RADIO))->GetCheck(); // (c.haag 2010-12-06 13:37) - PLID 42589 - Update control visibilities and enabled states. This used // to be done in LoadResult but now LoadResult only populates textand some label content. if(pCurTreeSel == NULL || pCurTreeSel->GetValue(lrtcResultID).vt == VT_NULL) { GetDlgItem(IDC_RESULT_NAME)->EnableWindow(FALSE); GetDlgItem(IDC_RESULT_LOINC)->EnableWindow(FALSE); // (a.walling 2010-01-18 11:18) - PLID 36936 m_nxlabelLOINC.SetType(dtsDisabledHyperlink); m_nxlabelLOINC.AskParentToRedrawWindow(); m_dtpDateReceived.EnableWindow(FALSE); GetDlgItem(IDC_SLIDE_NUMBER)->EnableWindow(FALSE); if(m_ltType != ltBiopsy) { // (r.galicki 2008-10-17 14:50) - PLID 31552 GetDlgItem(IDC_SLIDE_NUMBER_LABEL)->ShowWindow(FALSE); GetDlgItem(IDC_SLIDE_NUMBER)->ShowWindow(FALSE); } else { // (c.haag 2010-12-29 09:18) - Don't show the controls if they're supposed to be hidden GetDlgItem(IDC_SLIDE_NUMBER_LABEL)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_SLIDE_NUMBER)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); } GetDlgItem(IDC_LAB_DIAG_DESCRIPTION)->EnableWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->EnableWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->EnableWindow(FALSE); if(m_ltType != ltBiopsy) { // (r.galicki 2008-10-17 14:55) - PLID 31552 GetDlgItem(IDC_MICRO_DESC_LABEL)->ShowWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->ShowWindow(FALSE); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->ShowWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->ShowWindow(FALSE); // (b.spivey, August 27, 2013) - PLID 46295 - These fields only apply for biopsies. m_nxstaticAnatomicalLocationTextDiscrete.ShowWindow(FALSE); m_nxstaticAnatomicalLocationTextReport.ShowWindow(FALSE); } else { // (c.haag 2010-12-29 09:18) - Don't show the controls if they're supposed to be hidden GetDlgItem(IDC_MICRO_DESC_LABEL)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); // (b.spivey, August 27, 2013) - PLID 46295 - Show anatomical location on the discrete/report views. // (b.spivey, September 05, 2013) - PLID 46295 - hide the discrete text label if this is a parent row. m_nxstaticAnatomicalLocationTextDiscrete.ShowWindow(SW_HIDE); m_nxstaticAnatomicalLocationTextReport.ShowWindow(bHideControls ? SW_SHOW : SW_HIDE); } GetDlgItem(IDC_RESULT_REFERENCE)->EnableWindow(FALSE); m_nxeditResultComments.EnableWindow(FALSE); GetDlgItem(IDC_RESULT_VALUE)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_RESULT_VALUE)->EnableWindow(FALSE); GetDlgItem(IDC_RESULT_UNITS)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_RESULT_UNITS)->EnableWindow(FALSE); m_nxstaticUnitsLabel.ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_LAB_FLAG)->EnableWindow(FALSE); GetDlgItem(IDC_LAB_STATUS)->EnableWindow(FALSE); GetDlgItem(IDC_BTN_ADD_DIAGNOSIS)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_LAB_DIAGNOSES)->EnableWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_RESULT_STATUS)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_FLAG)->EnableWindow(FALSE); GetDlgItem(IDC_DELETE_RESULT)->EnableWindow(FALSE); //TES 11/30/2009 - PLID 36452 - If we have nothing selected, we can't add a result because we won't know what lab to add it to. GetDlgItem(IDC_ADD_RESULT)->EnableWindow(!(pCurTreeSel == NULL)); } else { IRowSettingsPtr pParent = GetResultRow(pCurTreeSel); // (z.manning 2010-05-12 10:53) - PLID 37400 - We now disable the editing of HL7 imported results // unless they have a permission. long nHL7MessageID = VarLong(pParent->GetValue(lrtcHL7MessageID), -1); BOOL bEnableResults = TRUE; if(nHL7MessageID != -1 && !CheckCurrentUserPermissions(bioPatientLabs, sptDynamic1, FALSE, 0, TRUE)) { bEnableResults = FALSE; } EnableResultWnd(bEnableResults, GetDlgItem(IDC_RESULT_NAME)); EnableResultWnd(bEnableResults, &m_dtpDateReceived); // (a.walling 2010-01-18 10:40) - PLID 36936 EnableResultWnd(bEnableResults, GetDlgItem(IDC_RESULT_LOINC)); // (r.galicki 2008-10-21 13:04) - PLID 31552 - Handle hidden columns if(m_ltType != ltBiopsy) { // (r.galicki 2008-10-17 14:50) - PLID 31552 GetDlgItem(IDC_SLIDE_NUMBER_LABEL)->EnableWindow(FALSE); GetDlgItem(IDC_SLIDE_NUMBER_LABEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_SLIDE_NUMBER)->EnableWindow(FALSE); GetDlgItem(IDC_SLIDE_NUMBER)->ShowWindow(SW_HIDE); } else { // (c.haag 2010-12-29 09:18) - Don't show the controls if they're supposed to be hidden GetDlgItem(IDC_SLIDE_NUMBER_LABEL)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_SLIDE_NUMBER)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); EnableResultWnd(bEnableResults, GetDlgItem(IDC_SLIDE_NUMBER)); } EnableResultWnd(bEnableResults, GetDlgItem(IDC_LAB_DIAG_DESCRIPTION)); if(m_ltType != ltBiopsy) { // (r.galicki 2008-10-17 14:50) - PLID 31552 GetDlgItem(IDC_MICRO_DESC_LABEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_MICRO_DESC_LABEL)->EnableWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->EnableWindow(FALSE); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->ShowWindow(SW_HIDE); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->EnableWindow(FALSE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->EnableWindow(FALSE); // (b.spivey, August 27, 2013) - PLID 46295 - These fields only apply for biopsies. m_nxstaticAnatomicalLocationTextDiscrete.ShowWindow(SW_HIDE); m_nxstaticAnatomicalLocationTextReport.ShowWindow(SW_HIDE); } else { GetDlgItem(IDC_MICRO_DESC_LABEL)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); EnableResultWnd(bEnableResults, GetDlgItem(IDC_CLINICAL_DIAGNOSIS_DESC)); // (b.spivey, August 27, 2013) - PLID 46295 - Show anatomical location on the discrete/report views. m_nxstaticAnatomicalLocationTextDiscrete.ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); m_nxstaticAnatomicalLocationTextReport.ShowWindow(bHideControls ? SW_SHOW : SW_HIDE); } long nMailID = VarLong(GetTreeValue(pCurTreeSel, lrfValue, lrtcForeignKeyID),-1); if (nMailID != -1) { //Hide the value field and show the document link GetDlgItem(IDC_RESULT_VALUE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RESULT_UNITS)->ShowWindow(SW_HIDE); // (c.haag 2009-05-07 09:18) - PLID 33789 m_nxstaticUnitsLabel.ShowWindow(SW_HIDE); } else { EnableResultWnd(bEnableResults, GetDlgItem(IDC_RESULT_VALUE)); GetDlgItem(IDC_RESULT_VALUE)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_RESULT_UNITS)->ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); // (c.haag 2009-05-07 09:18) - PLID 33789 m_nxstaticUnitsLabel.ShowWindow(bHideControls ? SW_HIDE : SW_SHOW); } EnableResultWnd(bEnableResults, GetDlgItem(IDC_RESULT_UNITS)); EnableResultWnd(bEnableResults, GetDlgItem(IDC_RESULT_REFERENCE)); // (z.manning 2009-04-30 16:59) - PLID 28560 - Added result comments m_nxeditResultComments.EnableWindow(TRUE); // (j.jones 2010-05-27 15:26) - PLID 38863 - you now need special permission to edit this field if(GetCurrentUserPermissions(bioPatientLabs) & sptDynamic2) { m_nxeditResultComments.SetReadOnly(FALSE); } else { m_nxeditResultComments.SetReadOnly(TRUE); } EnableResultWnd(bEnableResults, GetDlgItem(IDC_LAB_FLAG)); EnableResultWnd(bEnableResults, GetDlgItem(IDC_LAB_STATUS)); EnableResultWnd(bEnableResults, GetDlgItem(IDC_BTN_ADD_DIAGNOSIS)); EnableResultWnd(bEnableResults, GetDlgItem(IDC_CLINICAL_DIAGNOSIS_OPTIONS_LIST)); EnableResultWnd(bEnableResults, GetDlgItem(IDC_DELETE_RESULT)); bool bShowPatientEducationLink = (GetRemotePropertyInt("ShowPatientEducationLinks", 0, 0, GetCurrentUserName()) ? true : false); if(bEnableResults) { m_nxlabelLOINC.SetType(dtsHyperlink); // (j.jones 2013-11-08 15:30) - PLID 58979 - enable Pt. Education m_btnPatientEducation.EnableWindow(TRUE); // (r.gonet 2014-01-27 15:29) - PLID 59339 - If we are showing it as a link, fine, but otherwise it is a label (or hidden elsewhere) m_nxlabelPatientEducation.SetType(bShowPatientEducationLink ? dtsHyperlink : dtsText); m_nxlabelPatientEducation.AskParentToRedrawWindow(); } else { m_nxlabelLOINC.SetType(dtsDisabledHyperlink); // (j.jones 2013-11-08 15:30) - PLID 58979 - disable Pt. Education m_btnPatientEducation.EnableWindow(FALSE); // (r.gonet 2014-01-27 15:29) - PLID 59339 - If we are showing it as a link, fine, but otherwise it is a label (or hidden elsewhere) m_nxlabelPatientEducation.SetType(bShowPatientEducationLink ? dtsDisabledHyperlink : dtsDisabledText); m_nxlabelPatientEducation.AskParentToRedrawWindow(); } // (z.manning 2010-05-12 11:35) - PLID 37400 - These controls are all still enabled on read-only lab results GetDlgItem(IDC_EDIT_LAB_DIAGNOSES)->EnableWindow(TRUE); GetDlgItem(IDC_EDIT_CLINICAL_DIAGNOSIS_LIST)->EnableWindow(TRUE); GetDlgItem(IDC_EDIT_RESULT_STATUS)->EnableWindow(TRUE); GetDlgItem(IDC_EDIT_FLAG)->EnableWindow(TRUE); GetDlgItem(IDC_ADD_RESULT)->EnableWindow(TRUE); } // (c.haag 2010-12-06 13:37) - PLID 41618 - Just call UpdateDetachButton UpdateDetachButton(); // (c.haag 2010-12-06 15:49) - PLID 41618 - The result scroll buttons should be visible in the PDF view only GetDlgItem(IDC_RESULT_SCROLL_LEFT)->ShowWindow( (bInPDFView) ? SW_SHOW : SW_HIDE ); GetDlgItem(IDC_RESULT_SCROLL_RIGHT)->ShowWindow( (bInPDFView) ? SW_SHOW : SW_HIDE ); //set the state of each GetDlgItem(IDC_ADD_RESULT)->ShowWindow(nToggleHide); GetDlgItem(IDC_DELETE_RESULT)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULTS_TREE)->ShowWindow(nToggleHide); GetDlgItem(IDC_ATTACHED_FILE_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_NAME_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_NAME)->ShowWindow(nToggleHide); GetDlgItem(IDC_DATE_RECEIVED_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_DATE_RECEIVED)->ShowWindow(nToggleHide); GetDlgItem(IDC_VALUE_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_LOINC_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_LOINC)->ShowWindow(nToggleHide); GetDlgItem(IDC_DIAGNOSIS_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_BTN_ADD_DIAGNOSIS)->ShowWindow(nToggleHide); GetDlgItem(IDC_BTN_ADD_DIAGNOSIS)->ShowWindow(nToggleHide); GetDlgItem(IDC_BTN_ADD_DIAGNOSIS)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_DIAG_DESCRIPTION)->ShowWindow(nToggleHide); GetDlgItem(IDC_EDIT_LAB_DIAGNOSES)->ShowWindow(nToggleHide); GetDlgItem(IDC_STATIC)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_STATUS)->ShowWindow(nToggleHide); GetDlgItem(IDC_EDIT_RESULT_STATUS)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_COMMENTS_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_COMMENTS)->ShowWindow(nToggleHide); GetDlgItem(IDC_FLAG_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_FLAG)->ShowWindow(nToggleHide); GetDlgItem(IDC_EDIT_FLAG)->ShowWindow(nToggleHide); GetDlgItem(IDC_REFERENCE_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_RESULT_REFERENCE)->ShowWindow(nToggleHide); // (j.jones 2013-10-29 17:03) - PLID 58979 - added infobutton // (r.gonet 2014-01-27 15:29) - PLID 59339 - Consider the user's preferences to show or hide the patient education controls. bool bShowPatientEducationButton = (GetRemotePropertyInt("ShowPatientEducationButtons", 1, 0, GetCurrentUserName()) ? true : false); bool bShowPatientEducationLink = (GetRemotePropertyInt("ShowPatientEducationLinks", 0, 0, GetCurrentUserName()) ? true : false); GetDlgItem(IDC_PT_EDUCATION_LABEL)->ShowWindow((bShowPatientEducationLink || bShowPatientEducationButton) ? nToggleHide : SW_HIDE); GetDlgItem(IDC_BTN_PT_EDUCATION)->ShowWindow(bShowPatientEducationButton ? nToggleHide : SW_HIDE); // (b.spivey, September 6, 2013) - PLID 46295 - hide if in pdf view. if (bInPDFView) { m_nxstaticAnatomicalLocationTextDiscrete.ShowWindow(SW_HIDE); m_nxstaticAnatomicalLocationTextReport.ShowWindow(SW_HIDE); } // (c.haag 2010-11-22 12:29) - PLID 37372 - Toggle the background NxColor display GetDlgItem(IDC_LABRESULTS_NXCOLORCTRL_BACK)->ShowWindow((SW_SHOW == nToggleHide) ? SW_HIDE : SW_SHOW); GetDlgItem(IDC_LABRESULTS_NXCOLORCTRL_LEFT)->ShowWindow(nToggleHide); GetDlgItem(IDC_LABRESULTS_NXCOLORCTRL_RIGHT)->ShowWindow(nToggleHide); // (c.haag 2010-11-22 12:29) - Actually all of these things should persist for every view; but if we // ever change our minds, these controls are here for posterity /*// (c.haag 2010-11-22 12:29) - PLID 37372 - And now new signature and NxColor controls GetDlgItem(IDC_ACKNOWLEDGED_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_SIGNED_BY_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_SIGNED_BY)->ShowWindow(nToggleHide); GetDlgItem(IDC_SIGNED_DATE_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_SIGNED_DATE)->ShowWindow(nToggleHide); // (c.haag 2010-11-22 15:43) - PLID 40556 - Acknowledged controls GetDlgItem(IDC_LAB_ACKNOWLEDGE)->ShowWindow(nToggleHide); GetDlgItem(IDC_ACKNOWLEDGED_BY_LABEL)->ShowWindow(nToggleHide); // (c.haag 2010-12-02 16:33) - PLID 38633 - Completed controls GetDlgItem(IDC_LAB_MARK_COMPLETED)->ShowWindow(nToggleHide); GetDlgItem(IDC_COMPLETED_BY_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_COMPLETED_BY)->ShowWindow(nToggleHide); GetDlgItem(IDC_COMPLETED_RESULT_DATE_LABEL)->ShowWindow(nToggleHide); GetDlgItem(IDC_LAB_RESULT_COMPLETED_DATE)->ShowWindow(nToggleHide);*/ //TES 2/24/2012 - PLID 44841 - Added a button to configure the Report View, only show it if we're in that view GetDlgItem(IDC_CONFIGURE_REPORT_VIEW)->ShowWindow((nToggleHide == SW_SHOW || bInPDFView) ? SW_HIDE : SW_SHOW); // (c.haag 2011-12-28) - PLID 41618 - We need to track the hidden state so that LoadResult can reference it. // Since HideControls takes in a boolean instead of checking the radio buttons, we can't assume that the radio // buttons dictate this state. m_bControlsHidden = bHideControls; } // (c.haag 2010-12-02 09:46) - PLID 38633 - This function is called to mark individual results as completed void CLabResultsTabDlg::OnLabMarkCompleted() { try{ //DRT 7/7/2006 - PLID 21088 - Check permission if(!CheckCurrentUserPermissions(bioPatientLabs, sptDynamic0)) return; // (c.haag 2011-02-22) - PLID 41618 - Special handling for the attachments view if (m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnLabMarkCompleted(); } else { ThrowNxException("Called CLabResultsTabDlg::OnLabMarkCompleted without a valid attachment view!"); } } else { MarkLabCompleted(m_pResultsTree->CurSel); } } NxCatchAll(__FUNCTION__); } // (c.haag 2011-02-21) - PLID 41618 - Now takes in a row. pActiveRow can be a result or a specimen or null. // (j.luckoski 2013-03-20 11:40) - PLID 55424- added bool in order to mark all or allow specification void CLabResultsTabDlg::MarkLabCompleted(IRowSettingsPtr pActiveRow,bool bIsMarkAll /* =false */) { long nLabID; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - We only want the results for the current specimen. GetResults(nLabID, arypResultRows, groCurrentSpecimen); BOOL bAllResultsCompleted = AllResultsAreCompleted(nLabID); CArray<IRowSettingsPtr,IRowSettingsPtr> apIncompleteResults; // Array of row pointers to incomplete results. We use the ordinals as ID's in a multi-selection if necessary. // Quit right away if there's nothing to mark complete. The button should be disabled at this juncture. if (0 == arypResultRows.GetCount()) { return; } // If all results are marked completed, there's nothing to do. The button should be disabled at this juncture. else if (bAllResultsCompleted) { return; } else { GetIncompleteSignedResults(nLabID, apIncompleteResults); } // (c.haag 2010-12-02 09:51) - PLID 38633 - When we get here, apIncompleteResults is filled with all the // possible results that can be marked completed. Have the user decide which ones to complete if // necessary. if (apIncompleteResults.GetSize() == 0) { AfxMessageBox("There are no results that qualify for being marked completed. A result must be signed before being marked completed. ", MB_ICONSTOP); return; } else if (apIncompleteResults.GetSize() > 1 && !bIsMarkAll) { // Decision time // (j.armen 2012-06-08 09:32) - PLID 49607 - Input for this multiselect dlg isn't cacheable, so let's set a manual cache name CMultiSelectDlg dlg(this, "LabResultsT"); CStringArray astrResults; // Array of result names dlg.m_bPreSelectAll = TRUE; for (int i=0; i < apIncompleteResults.GetSize(); i++) { astrResults.Add(VarString(apIncompleteResults[i]->GetValue(lrtcValue), "")); } if (IDOK != dlg.OpenWithStringArray(astrResults, "Please select one or more results to mark completed", 1)) { return; } else { // Replace apIncompleteResults with only the selected CArray<IRowSettingsPtr,IRowSettingsPtr> apSelectedResults; CArray<long,long> arSelections; dlg.FillArrayWithIDs(arSelections); for (i=0; i < arSelections.GetSize(); i++) { apSelectedResults.Add( apIncompleteResults[ arSelections[i] ] ); } apIncompleteResults.Copy(apSelectedResults); } } else { // This means there's only one result to mark completed; no need to make the user choose it. } // (c.haag 2010-12-02 09:51) - PLID 38633 - Get the completed time COleDateTime dtCompleted; { _RecordsetPtr rs = CreateRecordset("SELECT GetDate() AS CurDateTime"); if(!rs->eof){ dtCompleted = AdoFldDateTime(rs, "CurDateTime"); } else { dtCompleted = COleDateTime::GetCurrentTime(); } } // (c.haag 2010-12-02 09:51) - PLID 38633 - Time to mark completed for (int i=0; i < apIncompleteResults.GetSize(); i++) { IRowSettingsPtr pResultRow = apIncompleteResults[i]; // Sanity check: If the result was already marked completed (which should never happen), do nothing. // Once a result is completed, the completed date must never change. if (-1 == VarLong(pResultRow->GetValue(lrtcCompletedBy), -1)) { pResultRow->PutValue(lrtcCompletedBy, (long)GetCurrentUserID()); pResultRow->PutValue(lrtcCompletedDate, _variant_t(dtCompleted, VT_DATE)); pResultRow->PutValue(lrtcCompletedUsername, _bstr_t(GetCurrentUserName())); } else { // The result was already marked completed! We absolutely need to raise an error here. ThrowNxException("Attempted to mark an already completed result as complete!"); } } // (c.haag 2010-12-02 10:28) - PLID 38633 - Update the mark completed button text FormatMarkCompletedButtonText(pActiveRow); } // (c.haag 2010-12-01 11:03) - PLID 37372 - Views a signature given a result row void CLabResultsTabDlg::ViewSignature(IRowSettingsPtr& pResultRow) { CString strSignatureFileName = VarString(pResultRow->GetValue(lrtcSignatureImageFile), ""); _variant_t varSignatureInkData = pResultRow->GetValue(lrtcSignatureInkData); _variant_t varSignatureTextData = pResultRow->GetValue(lrtcSignatureTextData); // (z.manning 2008-10-15 15:08) - PLID 21082 - Now must sign the lab as well CSignatureDlg dlgSign(this); // (j.jones 2010-04-12 17:29) - PLID 38166 - added a date/timestamp dlgSign.SetSignature(strSignatureFileName, varSignatureInkData, varSignatureTextData); dlgSign.m_bRequireSignature = TRUE; dlgSign.m_bReadOnly = TRUE; // (z.manning 2008-12-09 09:07) - PLID 32260 - Added a preference for checking for password when loading signature. dlgSign.m_bCheckPasswordOnLoad = (GetRemotePropertyInt("SignatureCheckPasswordLab", 1, 0, GetCurrentUserName()) == 1); dlgSign.DoModal(); } // (c.haag 2010-12-01 11:03) - PLID 37372 - Populates apResults with all the result rows for a specified lab that have no signatures. void CLabResultsTabDlg::GetUnsignedResults(long nLabID, CArray<IRowSettingsPtr,IRowSettingsPtr>& apResults) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; //TES 11/6/2012 - PLID 53591 - There's a preference now to sign/acknowledge all specimens if(bInPDFView || GetRemotePropertyInt("SignAndAcknowledgeResultsForAllSpecimens", 0, 0, "<None>")) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return; } arypLabRows.Add(pLabRow); } apResults.RemoveAll(); for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pChildRow = pLabRow->GetFirstChildRow(); while (pChildRow) { if (pChildRow->GetValue(lrtcSignatureInkData).vt == VT_NULL) { apResults.Add(pChildRow); } pChildRow = pChildRow->GetNextRow(); } } } // (z.manning 2011-06-22 09:43) - PLID 44154 void CLabResultsTabDlg::GetUnacknowledgedResults(long nLabID, CArray<IRowSettingsPtr,IRowSettingsPtr> &arypResults) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; //TES 11/6/2012 - PLID 53591 - There's a preference now to sign/acknowledge all specimens if(bInPDFView || GetRemotePropertyInt("SignAndAcknowledgeResultsForAllSpecimens", 0, 0, "<None>")) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return; } arypLabRows.Add(pLabRow); } arypResults.RemoveAll(); for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pChildRow = pLabRow->GetFirstChildRow(); while (pChildRow) { if (GetTreeValue(pChildRow, lrfAcknowledgedBy, lrtcForeignKeyID).vt == VT_NULL) { arypResults.Add(pChildRow); } pChildRow = pChildRow->GetNextRow(); } } } // (c.haag 2010-12-02 09:59) - PLID 38633 - Populates apResults with all the result rows that are not marked completed // but have been signed void CLabResultsTabDlg::GetIncompleteSignedResults(long nLabID, CArray<NXDATALIST2Lib::IRowSettingsPtr,NXDATALIST2Lib::IRowSettingsPtr>& apResults) { BOOL bInPDFView = (IsDlgButtonChecked(IDC_PDFVIEW_RADIO) == BST_CHECKED); CArray<IRowSettingsPtr,IRowSettingsPtr> arypLabRows; //TES 2/17/2015 - PLID 63812 - Use the preference to sign/acknowledge all specimens if (bInPDFView || GetRemotePropertyInt("SignAndAcknowledgeResultsForAllSpecimens", 0, 0, "<None>")) { // (z.manning 2011-06-17 09:58) - PLID 44154 - Attachment view is not lab-specific for(IRowSettingsPtr pLabRow = m_pResultsTree->GetFirstRow(); pLabRow != NULL; pLabRow = pLabRow->GetNextRow()) { arypLabRows.Add(pLabRow); } } else { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return; } arypLabRows.Add(pLabRow); } apResults.RemoveAll(); for(int nLabIndex = 0; nLabIndex < arypLabRows.GetSize(); nLabIndex++) { IRowSettingsPtr pLabRow = arypLabRows.GetAt(nLabIndex); IRowSettingsPtr pChildRow = pLabRow->GetFirstChildRow(); while (pChildRow) { if (-1 == VarLong(pChildRow->GetValue(lrtcCompletedBy), -1) && pChildRow->GetValue(lrtcSignatureInkData).vt != VT_NULL) { apResults.Add(pChildRow); } pChildRow = pChildRow->GetNextRow(); } } } // (c.haag 2010-12-01 11:16) - PLID 37372 - Called when the user presses the signature button. // The signature corresponds to a single result. void CLabResultsTabDlg::OnSignature() { try { // (c.haag 2010-12-10 10:08) - PLID 38633 - sptDynamic0 was defined as "Mark Completed". // We actually now check sptDynamic3 which is "Signed". Anyone who had sptDynamic0 permission // before has sptDynamic3 now. This permission applies to both requisition signatures and result // signatures. if(!CheckCurrentUserPermissions(bioPatientLabs, sptDynamic3)) return; // (c.haag 2010-12-01 11:16) - PLID 37372 - Perform based on the current selection and // what results are signed // (c.haag 2011-02-22) - PLID 41618 - Special handling for the attachments view if (m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnSignature(); } else { ThrowNxException("Called CLabResultsTabDlg::OnSignature without a valid attachment view!"); } } else { SignResults(m_pResultsTree->CurSel); } } NxCatchAll(__FUNCTION__); } // (z.manning 2011-06-22 10:39) - PLID 44154 CString CLabResultsTabDlg::GetResultRowText(IRowSettingsPtr pResultRow) { if(pResultRow == NULL) { return ""; } CString strResultText = VarString(pResultRow->GetValue(lrtcValue), ""); IRowSettingsPtr pLabRow = GetLabRow(pResultRow); if(pLabRow != NULL) { CString strLabNumber = VarString(pLabRow->GetValue(lrtcValue), ""); if(!strLabNumber.IsEmpty()) { strResultText += " (" + strLabNumber + ")"; } } return strResultText; } // (c.haag 2011-02-22) - PLID 41618 - Self-contained function for signing results. pActiveRow can be a result or a specimen or null. // (j.luckoski 2013-03-20 11:40) - PLID 55424- added bool in order to mark all or allow specification void CLabResultsTabDlg::SignResults(NXDATALIST2Lib::IRowSettingsPtr pActiveRow,bool bIsMarkAll /* =false */) { // (c.haag 2010-12-01 11:16) - PLID 37372 - Perform based on pActiveRow and what results are signed long nLabID; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); BOOL bAllResultsSigned = AllResultsAreSigned(nLabID); CArray<IRowSettingsPtr,IRowSettingsPtr> apUnsignedResults; // Array of row pointers to results. We use the ordinals as ID's in a multi-selection if necessary. // The following should never be true if (-2 == nLabID || 0 == arypResultRows.GetSize()) { return; } GetUnsignedResults(nLabID, apUnsignedResults); // If there's only one result, keep it simple. if (1 == arypResultRows.GetSize()) { if (apUnsignedResults.GetSize() == 0) { ViewSignature(arypResultRows.GetAt(0)); return; } } // If we have a possible mix of signed and unsigned results, act based on pSelectedResultRow else { BOOL bShowMenu = FALSE; CMenu mnu; mnu.CreatePopupMenu(); // If all results are signed, deal only with signatures if (bAllResultsSigned) { if(arypResultRows.GetSize() == 1) { ViewSignature(arypResultRows.GetAt(0)); return; } else { bShowMenu = TRUE; } } else if(apUnsignedResults.GetCount() < arypResultRows.GetCount()) { bShowMenu = TRUE; // We have an active result and it's signed. Track a menu that lets the user choose between viewing the signature // and signing for other results mnu.AppendMenu(MF_ENABLED, -2, "Sign Other Results"); } if(bShowMenu) { // (z.manning 2011-06-22 10:55) - PLID 44154 - Add menu options to view the signature for each signed row. // We'll use the value of the row pointer for the menu option so we can identify which row the user selected. for(int nResultIndex = 0; nResultIndex < arypResultRows.GetCount(); nResultIndex++) { IRowSettingsPtr pResultRow = arypResultRows.GetAt(nResultIndex); if(pResultRow->GetValue(lrtcSignatureInkData).vt != VT_NULL) { mnu.AppendMenu(MF_ENABLED, (UINT)((LPDISPATCH)pResultRow), "View Signature for '" + GetResultRowText(pResultRow) + "'"); } } CPoint ptClicked; GetCursorPos(&ptClicked); int nResult = mnu.TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD, ptClicked.x, ptClicked.y, this); // Now process the menu selection if(nResult > 0) { IRowSettingsPtr pSelectedRow((LPDISPATCH)nResult); if(pSelectedRow != NULL) { ViewSignature(pSelectedRow); } return; } else if (nResult == -2) { GetUnsignedResults(nLabID, apUnsignedResults); } else { return; } } } // (c.haag 2010-12-01 11:16) - PLID 37372 - When we get here, apUnsignedResults is filled with all the // possible results that can be signed. Have the user decide which ones to sign. if (apUnsignedResults.GetSize() > 1 && !bIsMarkAll) { // (j.armen 2012-06-08 09:32) - PLID 49607 - Input for this multiselect dlg isn't cacheable, so let's set a manual cache name CMultiSelectDlg dlg(this, "LabResultsT"); CStringArray astrResults; // Array of result names dlg.m_bPreSelectAll = TRUE; for (int i=0; i < apUnsignedResults.GetSize(); i++) { astrResults.Add(GetResultRowText(apUnsignedResults[i])); } if (IDOK != dlg.OpenWithStringArray(astrResults, "Please select one or more results to sign off", 1)) { return; } else { // Replace apUnsignedResults with only the selected CArray<IRowSettingsPtr,IRowSettingsPtr> apSelectedResults; CArray<long,long> arSelections; dlg.FillArrayWithIDs(arSelections); for (i=0; i < arSelections.GetSize(); i++) { apSelectedResults.Add( apUnsignedResults[ arSelections[i] ] ); } apUnsignedResults.Copy(apSelectedResults); } } else { // Only one result can be signed; no need for a multi-select popup } // (c.haag 2010-12-01 11:16) - PLID 37372 - Do the signature CString strSignatureFileName = ""; _variant_t varSignatureInkData = g_cvarNull; _variant_t varSignatureTextData = g_cvarNull; // (z.manning 2008-10-15 15:08) - PLID 21082 - Now must sign the lab as well CSignatureDlg dlgSign(this); // (j.jones 2010-04-12 17:29) - PLID 38166 - added a date/timestamp dlgSign.SetSignature(strSignatureFileName, varSignatureInkData, varSignatureTextData); dlgSign.m_bRequireSignature = TRUE; // (z.manning 2008-12-09 09:07) - PLID 32260 - Added a preference for checking for password when loading signature. dlgSign.m_bCheckPasswordOnLoad = (GetRemotePropertyInt("SignatureCheckPasswordLab", 1, 0, GetCurrentUserName()) == 1); if(dlgSign.DoModal() != IDOK) { return; } strSignatureFileName = dlgSign.GetSignatureFileName(); varSignatureInkData = dlgSign.GetSignatureInkData(); // (j.jones 2010-04-12 17:29) - PLID 38166 - added a date/timestamp varSignatureTextData = dlgSign.GetSignatureTextData(); COleDateTime dtNow; { _RecordsetPtr rs = CreateRecordset("SELECT GetDate() AS CurDateTime"); if(!rs->eof){ dtNow = AdoFldDateTime(rs, "CurDateTime"); } else { dtNow = COleDateTime::GetCurrentTime(); } } if(varSignatureTextData.vt != VT_EMPTY && varSignatureTextData.vt != VT_NULL) { // (j.jones 2010-04-13 08:48) - PLID 38166 - the loaded text is the words "Date/Time", // we need to replace it with the actual date/time CNxInkPictureText nipt; nipt.LoadFromVariant(varSignatureTextData); CString strDate; if(dlgSign.GetSignatureDateOnly()) { strDate = FormatDateTimeForInterface(dtNow, NULL, dtoDate); } else { strDate = FormatDateTimeForInterface(dtNow, DTF_STRIP_SECONDS, dtoDateTime); } //technically, there should only be one SIGNATURE_DATE_STAMP_ID in the array, //and currently we don't support more than one stamp in the signature //anyways, but just incase, replace all instances of the SIGNATURE_DATE_STAMP_ID with //the current date/time for(int i=0; i<nipt.GetStringCount(); i++) { if(nipt.GetStampIDByIndex(i) == SIGNATURE_DATE_STAMP_ID) { nipt.SetStringByIndex(i, strDate); } } _variant_t vNewSigTextData = nipt.GetAsVariant(); varSignatureTextData = vNewSigTextData; } // (c.haag 2010-12-01 11:16) - PLID 37372 - Now populate the selected results for (int i=0; i < apUnsignedResults.GetSize(); i++) { IRowSettingsPtr pResultRow = apUnsignedResults[i]; pResultRow->PutValue(lrtcSignatureImageFile, _bstr_t( strSignatureFileName )); pResultRow->PutValue(lrtcSignatureInkData, varSignatureInkData); pResultRow->PutValue(lrtcSignatureTextData, varSignatureTextData); pResultRow->PutValue(lrtcSignedBy, (long)GetCurrentUserID()); pResultRow->PutValue(lrtcSignedDate, _variant_t(dtNow, VT_DATE)); pResultRow->PutValue(lrtcSignedUsername, _bstr_t(GetCurrentUserName())); } // (c.haag 2010-12-01 11:16) - PLID 37372 - Set the signature button text FormatSignButtonText(pActiveRow); } // (c.haag 2010-11-22 15:39) - PLID 40556 - This even handles the Acknowledge Result button press. The // general logic flow should closely follow FormatAcknowledgedButtonText; please compare them when reviewing or // changing code. void CLabResultsTabDlg::OnAcknowledgeResult() { try { // (c.haag 2011-02-22) - PLID 41618 - Special handling when in the attachments view if (m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnAcknowledgeResult(); } else { ThrowNxException("Called CLabResultsTabDlg::OnAcknowledgeResult without a valid attachment view!"); } } else { AcknowledgeResults(m_pResultsTree->CurSel); } } NxCatchAll(__FUNCTION__); } // (c.haag 2011-02-22) - PLID 41618 - Self-contained function for acknowleding results. pActiveRow can be a result or a specimen or null. // (j.luckoski 2013-03-20 11:40) - PLID 55424- added bool in order to mark all or allow specification void CLabResultsTabDlg::AcknowledgeResults(IRowSettingsPtr pActiveRow, bool bIsMarkAll /* =false */) { long nLabID; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } CArray<IRowSettingsPtr,IRowSettingsPtr> arypResultRows; //TES 11/6/2012 - PLID 53591 - Check the preference to include all specimens GetResults(nLabID, arypResultRows, groCheckPreference); if (-2 == nLabID || 0 == arypResultRows.GetCount()) { // We should never get here return; } CArray<IRowSettingsPtr,IRowSettingsPtr> arypUnacknowledgedResults; GetUnacknowledgedResults(nLabID, arypUnacknowledgedResults); BOOL bAllResultsAcknowledged = AllResultsAreAcknowledged(nLabID); IRowSettingsPtr pUnacknowledgeRow = NULL; int nResult = 0; // 0 = Undefined, 1 = Unacknowledge, -2 = Acknowledge if (1 == arypResultRows.GetCount()) { if (VT_NULL != GetTreeValue(arypResultRows.GetAt(0), lrfAcknowledgedBy, lrtcForeignKeyID).vt) { // Already acknowledged. The action will be to unacknowledge the result. nResult = 1; pUnacknowledgeRow = arypResultRows.GetAt(0); } else { // Let the user acknowledge it. nResult = -2; } } else { BOOL bShowMenu = FALSE; CMenu mnu; mnu.CreatePopupMenu(); // Special handling for when all results are acknowledged if (bAllResultsAcknowledged) { // Already acknowledged. The action will be to unacknowledge the result. nResult = 1; bShowMenu = TRUE; } else { // If we get here, one or more results are not acknowledged. No matter what the // result selection is, we want them to be able to acknowledge anything that is not // already acknowledged. If we have a valid result selected and it's acknowledged, we // need to be able to unacknowledge it. if (arypUnacknowledgedResults.GetCount() < arypResultRows.GetCount()) { bShowMenu = TRUE; // We could unacknowledge this result, or we could acknowledge other ones. Who knows? mnu.AppendMenu(MF_ENABLED, -2, "Acknowledge Other Results"); } else { nResult = -2; // Acknowledge results } } if(bShowMenu) { // (z.manning 2011-06-22 10:55) - PLID 44154 - Add menu options to unacknowledge for each acknowledged row. // We'll use the value of the row pointer for the menu option so we can identify which row the user selected. for(int nResultIndex = 0; nResultIndex < arypResultRows.GetCount(); nResultIndex++) { IRowSettingsPtr pResultRow = arypResultRows.GetAt(nResultIndex); if(GetTreeValue(pResultRow, lrfAcknowledgedBy, lrtcForeignKeyID).vt != VT_NULL) { mnu.AppendMenu(MF_ENABLED, (UINT)((LPDISPATCH)pResultRow), "Unacknowledge Result: '" + GetResultRowText(pResultRow) + "'"); } } CPoint ptClicked; GetCursorPos(&ptClicked); nResult = mnu.TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD, ptClicked.x, ptClicked.y, this); if(nResult > 0) { pUnacknowledgeRow = (LPDISPATCH)nResult; if(pUnacknowledgeRow == NULL) { return; } nResult = 1; } } } // Now process the user action switch (nResult) { case 1: // Unacknowledge if(pUnacknowledgeRow == NULL) { return; } if (IDNO == MsgBox(MB_YESNO, "The user '%s' acknowledged this lab result on %s. Are you SURE you wish to reset this status?", GetExistingUserName(VarLong(GetTreeValue(pUnacknowledgeRow, lrfAcknowledgedBy, lrtcForeignKeyID))), FormatDateTimeForInterface(GetTreeValue(pUnacknowledgeRow, lrfAcknowledgedOn, lrtcValue), DTF_STRIP_SECONDS, dtoDateTime))) { return; } else { SetTreeValue(pUnacknowledgeRow, lrfAcknowledgedBy, lrtcForeignKeyID, g_cvarNull); SetTreeValue(pUnacknowledgeRow, lrfAcknowledgedOn, lrtcValue, g_cvarNull); m_bResultIsSaved = FALSE; } break; case -2: // Acknowledge { // If there's just one, there's no need to pop up a multi-select dialog if (arypUnacknowledgedResults.GetSize() > 1 && !bIsMarkAll) { // (j.armen 2012-06-08 09:32) - PLID 49607 - Input for this multiselect dlg isn't cacheable, so let's set a manual cache name CMultiSelectDlg dlg(this, "LabResultsT"); CStringArray astrResults; // Array of result names dlg.m_bPreSelectAll = TRUE; for (int i=0; i < arypUnacknowledgedResults.GetSize(); i++) { IRowSettingsPtr pRow = arypUnacknowledgedResults[i]; astrResults.Add(GetResultRowText(pRow)); } if (IDOK != dlg.OpenWithStringArray(astrResults, "Please select one or more results to acknowledge", 1)) { return; } else { // Replace apResults with only the selected CArray<IRowSettingsPtr,IRowSettingsPtr> apSelectedResults; CArray<long,long> arSelections; dlg.FillArrayWithIDs(arSelections); for (i=0; i < arSelections.GetSize(); i++) { apSelectedResults.Add( arypUnacknowledgedResults[ arSelections[i] ] ); } arypUnacknowledgedResults.Copy(apSelectedResults); } } else { // Only one result can be acknowledged; no need for a multi-select popup } // Acknowledge each selected result const long nUserID = GetCurrentUserID(); const COleDateTime dtNow = COleDateTime::GetCurrentTime(); for (int i=0; i < arypUnacknowledgedResults.GetSize(); i++) { IRowSettingsPtr pR = arypUnacknowledgedResults[i]; SetTreeValue(pR, lrfAcknowledgedBy, lrtcForeignKeyID, nUserID); SetTreeValue(pR, lrfAcknowledgedOn, lrtcValue, _variant_t(dtNow, VT_DATE)); } m_bResultIsSaved = FALSE; } break; } // Update the button FormatAcknowledgedButtonText(pActiveRow); FormatAcknowledgeAndSignButtonText(pActiveRow); FormatMarkAllCompleteButtonText(pActiveRow); } // (j.gruber 2010-11-30 09:14) - PLID 41606 void CLabResultsTabDlg::LoadHTMLReport(NXDATALIST2Lib::IRowSettingsPtr pSpecRow) { //load the HTML for each Result for this specimen CString strResultHTML; // (j.gruber 2010-12-08 13:42) - PLID 41662 - make sure everything is hidden so it doesn't draw though the PDF viewer // (c.haag 2011-02-22) - PLID 42589 - Pass in the current tree selection UpdateControlStates(true, m_pResultsTree->CurSel); NXDATALIST2Lib::IRowSettingsPtr pResult = pSpecRow->GetFirstChildRow(); while (pResult) { strResultHTML += GetResultHTML(pResult); /*long nResultID = VarLong(pResult->GetValue(lrtcResultID)); //look up the result in the map stResults *pstRes = NULL; if (!m_mapResults.Lookup(nResultID, pstRes)) { ASSERT(FALSE); } if (pstRes) { strResultHTML += GetResultHTML(pstRes); }*/ pResult = pResult->GetNextRow(); } //now that we have the result HTML Generate our wrapper HTML CString strHTML; // (j.gruber 2010-12-08 14:19) - PLID 41759 strHTML = GetHeaderHTML(pSpecRow); strHTML += strResultHTML; strHTML += GetFooterHTML(); // (j.gruber 2010-11-30 09:14) - PLID 41606 - unload any previous reports UnloadHTMLReports(); //now create the filename long nLabID = VarLong(pSpecRow->GetValue(lrtcForeignKeyID)); CString strFileName = GetHTMLFileName(nLabID); CFile fileTemp(strFileName, CFile::modeCreate|CFile::modeReadWrite); fileTemp.Write((LPCTSTR)strHTML, strHTML.GetLength()); //load our array with our report m_straryLabReports.Add(strFileName); //flag it to get removed at reboot in case of crash or something MoveFileEx(strFileName, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); //Now we have to make the control browse to it COleVariant varURL(strFileName); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varURL, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(TRUE); // (b.spivey, August 27, 2013) - PLID 46295 - Show anatomical location on the discrete/report views. CString strAnatomicLocation = GetAnatomicalLocationAsString(nLabID); //discrete results m_nxstaticAnatomicalLocationTextDiscrete.SetWindowTextA(strAnatomicLocation); m_nxstaticAnatomicalLocationTextDiscrete.ShowWindow(SW_HIDE); //report view m_nxstaticAnatomicalLocationTextReport.SetWindowTextA(strAnatomicLocation); m_nxstaticAnatomicalLocationTextReport.ShowWindow(SW_SHOW); // (j.gruber 2010-11-30 09:14) - PLID 41607 UpdateScrollButtons(); } // (j.gruber 2010-11-30 09:14) - PLID 41606 CString CLabResultsTabDlg::GetHTMLFileName(long nLabID) { CString strFileName; strFileName.Format("nexlab_%li_%lu.htm", nLabID, GetTickCount()); CString strFullName = GetNxTempPath() ^ strFileName; return strFullName; } // (j.gruber 2010-11-30 09:14) - PLID 41653 // (j.gruber 2010-12-08 14:19) - PLID 41759 - added row CString CLabResultsTabDlg::GetHeaderHTML(NXDATALIST2Lib::IRowSettingsPtr pSpecRow) { CString strHeader; //TES 2/24/2012 - PLID 44841 - Need doc type switching to get the tables to look right strHeader += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; strHeader += "<HTML>\r\n"; strHeader += GetStyle(); strHeader += "\t<HEAD>\r\n"; // (j.gruber 2010-12-08 11:49) - PLID 41759 if (pSpecRow) { //get the Specimen number of the lab _variant_t varForm = pSpecRow->GetValue(lrtcValue); CString strForm; if (varForm.vt == VT_BSTR) { strForm = VarString(varForm); } else { strForm = ""; } //TES 9/10/2013 - PLID 58511 - If this lab has been replaced, put a warning at the very top //TES 11/5/2013 - PLID 59320 - Modified the warning, now that the results are actually hidden if(VarBool(pSpecRow->GetValue(lrtcExtraValue), FALSE)) { strHeader += "\t\t<H2> Some results for this order have been replaced by subsequent results, and have been removed from this display</H2>\r\n"; } // (r.gonet 07/26/2013) - PLID 57751 - Escape the value does not include any syntax characters. strHeader += "\t\t<H1> " + ConvertToQuotableXMLString(strForm) + "</H1>\r\n"; // (d.singleton 2013-10-29 15:17) - PLID 59197 - need to move the specimen segment values to its own header in the html view for labs, so it will show regardless of any results. strHeader += GetSpecimenFieldsHTML(pSpecRow); } strHeader += "\t</HEAD>\r\n"; strHeader += "\t<BODY>\r\n"; return strHeader; } // (j.gruber 2010-11-30 09:14) - PLID 41653 CString CLabResultsTabDlg::GetFooterHTML() { CString strFooter; strFooter += "\t</BODY>\r\n"; strFooter += "</HTML>\r\n"; return strFooter; } //TES 2/24/2012 - PLID 44841 - New function to get the HTML for a single result field. Takes in the row, a ResultFieldPosition that specifies // both the field and its position in the report, and the column width, and outputs whether or not it actually filled any information. CString CLabResultsTabDlg::GetResultFieldHTML(NXDATALIST2Lib::IRowSettingsPtr pResultRow, const CLabResultsTabDlg::ResultFieldPosition &rfp, bool &bFilled, long nColumnWidth) { //TES 2/24/2012 - PLID 44841 - Get the name of the field, a name for the div, and the value of the field, based on rfp CString strFieldName, strDivName, strFieldValue; switch(rfp.lrf) { case lrfName: strFieldName = "Name"; strDivName = "ResultName"; strFieldValue = VarString(pResultRow->GetValue(lrtcValue), ""); break; case lrfDateReceivedByLab: strFieldName = "Date Received By Lab"; strDivName = "DateReceivedByLab"; { _variant_t varDateReceivedByLab = GetTreeValue(pResultRow, lrfDateReceivedByLab, lrtcValue); COleDateTime dtReceivedByLab; if (varDateReceivedByLab.vt == VT_DATE) { dtReceivedByLab = VarDateTime(varDateReceivedByLab); } else if (varDateReceivedByLab.vt == VT_BSTR) { if (VarString(varDateReceivedByLab).IsEmpty()) { dtReceivedByLab.SetStatus(COleDateTime::invalid); } else { dtReceivedByLab.ParseDateTime(VarString(varDateReceivedByLab)); } } else { dtReceivedByLab.SetStatus(COleDateTime::invalid); } if (dtReceivedByLab.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtReceivedByLab); } } break; case lrfDateReceived: strFieldName = "Date Received"; strDivName = "DateReceived"; { _variant_t varDateReceived = GetTreeValue(pResultRow, lrfDateReceived, lrtcValue); COleDateTime dtReceived; if (varDateReceived.vt == VT_DATE) { dtReceived = VarDateTime(varDateReceived); } else if (varDateReceived.vt == VT_BSTR) { if (VarString(varDateReceived).IsEmpty()) { dtReceived.SetStatus(COleDateTime::invalid); } else { dtReceived.ParseDateTime(VarString(varDateReceived)); } } else { dtReceived.SetStatus(COleDateTime::invalid); } if (dtReceived.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtReceived); } } break; case lrfDatePerformed: strFieldName = "Date Performed"; strDivName = "DatePerformed"; { _variant_t varDatePerformed = GetTreeValue(pResultRow, lrfDatePerformed, lrtcValue); COleDateTime dtPerformed; if (varDatePerformed.vt == VT_DATE) { dtPerformed = VarDateTime(varDatePerformed); } else if (varDatePerformed.vt == VT_BSTR) { if (VarString(varDatePerformed).IsEmpty()) { dtPerformed.SetStatus(COleDateTime::invalid); } else { dtPerformed.ParseDateTime(VarString(varDatePerformed)); } } else { dtPerformed.SetStatus(COleDateTime::invalid); } if (dtPerformed.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtPerformed); } } break; case lrfSlideNum: strFieldName = "Slide #"; strDivName = "SlideNumber"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfSlideNum, lrtcValue),""); break; case lrfLOINC: strFieldName = strDivName = "LOINC"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfLOINC, lrtcValue),""); break; case lrfStatus: strFieldName = strDivName = "Status"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfStatus,lrtcValue), ""); break; case lrfFlag: strFieldName = strDivName = "Flag"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfFlag, lrtcValue), ""); break; case lrfAcknowledgedBy: strFieldName = strDivName = "Acknowledged"; { long nAcknowledgedUserID = VarLong(GetTreeValue(pResultRow, lrfAcknowledgedBy, lrtcForeignKeyID), -1); COleDateTime dtInvalid; dtInvalid.SetStatus(COleDateTime::invalid); COleDateTime dtAcknowledgedDate = VarDateTime(GetTreeValue(pResultRow, lrfAcknowledgedOn, lrtcValue), dtInvalid); strFieldValue = (nAcknowledgedUserID != -1 ? "By " + GetExistingUserName(nAcknowledgedUserID) + " on " + FormatDateTimeForInterface(dtAcknowledgedDate) : "No"); } break; case lrfUnits: strFieldName = strDivName = "Units"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfUnits,lrtcValue), ""); break; case lrfReference: strFieldName = strDivName = "Reference"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfReference,lrtcValue), ""); break; case lrfDiagnosis: strFieldName = strDivName = "Diagnosis"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfDiagnosis, lrtcValue), ""); break; case lrfMicroscopicDescription: strFieldName = "Microscopic Description"; strDivName = "MicroDesc"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfMicroscopicDescription, lrtcValue), ""); break; // (d.singleton 2013-07-16 17:35) - PLID 57600 - show CollectionStartTime and CollectionEndTime in the html view of lab results case lrfServiceStartTime: strFieldName = "Lab Service Start Time"; strDivName = "ServiceStartTime"; { _variant_t var = GetTreeValue(pResultRow, lrfServiceStartTime, lrtcValue); COleDateTime dtServiceStartTime; if(var.vt == VT_DATE) { dtServiceStartTime = VarDateTime(var); } else if(var.vt == VT_BSTR) { if(VarString(var).IsEmpty()) { dtServiceStartTime.SetStatus(COleDateTime::invalid); } else { dtServiceStartTime.ParseDateTime(VarString(var)); } } else { dtServiceStartTime.SetStatus(COleDateTime::invalid); } if(dtServiceStartTime.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtServiceStartTime); } } break; case lrfServiceEndTime: strFieldName = "Lab Service End Time"; strDivName = "ServiceEndTime"; { _variant_t var = GetTreeValue(pResultRow, lrfServiceEndTime, lrtcValue); COleDateTime dtServiceEndTime; if(var.vt == VT_DATE) { dtServiceEndTime = VarDateTime(var); } else if(var.vt == VT_BSTR) { if(VarString(var).IsEmpty()) { dtServiceEndTime.SetStatus(COleDateTime::invalid); } else { dtServiceEndTime.ParseDateTime(VarString(var)); } } else { dtServiceEndTime.SetStatus(COleDateTime::invalid); } if(dtServiceEndTime.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtServiceEndTime); } } break; case lrfPerformingProvider: strFieldName = "Performing Provider"; strDivName = "PerformingProvider"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerformingProvider, lrtcValue), ""); break; // (d.singleton 2013-10-25 12:22) - PLID 59181 - need new option to pull performing lab from obx23 and show on the html view case lrfPerformingLab: strFieldName = "Performing Lab"; strDivName = "PerformingLab"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerformingLab, lrtcValue), ""); break; case lrfPerfLabAddress: strFieldName = "Perf Lab Address"; strDivName = "PerfLabAddress"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerfLabAddress, lrtcValue), ""); break; case lrfPerfLabCity: strFieldName = "Perf Lab City"; strDivName = "PerfLabCity"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerfLabCity, lrtcValue), ""); break; case lrfPerfLabState: strFieldName = "Perf Lab State"; strDivName = "PerfLabState"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerfLabState, lrtcValue), ""); break; case lrfPerfLabZip: strFieldName = "Perf Lab Zip"; strDivName = "PerfLabZip"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerfLabZip, lrtcValue), ""); break; case lrfPerfLabCountry: strFieldName = "Perf Lab Country"; strDivName = "PerfLabCountry"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerfLabCountry, lrtcValue), ""); break; case lrfPerfLabParish: strFieldName = "Perf Lab Parish"; strDivName = "PerfLabParish"; strFieldValue = VarString(GetTreeValue(pResultRow, lrfPerfLabParish, lrtcValue), ""); break; // (d.singleton 2013-11-04 17:06) - PLID 59294 - add observation date to the html view for lab results. case lrfObservationDate: strFieldName = "Observation Date"; strDivName = "ObservationDate"; { _variant_t var = GetTreeValue(pResultRow, lrfObservationDate, lrtcValue); COleDateTime dtObservationDate; if(var.vt == VT_DATE) { dtObservationDate = VarDateTime(var); } else if(var.vt == VT_BSTR) { if(VarString(var).IsEmpty()) { dtObservationDate.SetStatus(COleDateTime::invalid); } else { dtObservationDate.ParseDateTime(VarString(var)); } } else { dtObservationDate.SetStatus(COleDateTime::invalid); } if(dtObservationDate.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtObservationDate); } } break; } // (r.gonet 07/26/2013) - PLID 57751 - Escape the value does not include any syntax characters. strFieldName = ConvertToQuotableXMLString(strFieldName); // (r.gonet 07/26/2013) - PLID 57751 - Escape the value does not include any syntax characters. strFieldValue = ConvertToQuotableXMLString(strFieldValue); //TES 2/24/2012 - PLID 44841 - Now, if we have a value, return HTML outputting that value in a column of the width we were given. if(!strFieldValue.IsEmpty()) { bFilled = true; CString strHTML; strHTML += FormatString("\t\t\t\t<td colspan=\"1\">\r\n"); strHTML += FormatString("\t\t\t\t\t<div id=\"%s\" style=\"width:%ipx;text-align:left;vertical-align:top;\"> \r\n", strDivName, nColumnWidth); strHTML += FormatString("\t\t\t\t\t\t<span class=\"MinorTitle\"> %s: </span> \r\n", strFieldName); // (r.gonet 07/26/2013) - PLID 57751 - Noticed linebreaks weren't being retained in the report view for mapped fields. Fixed. strFieldValue.Replace("\r\n", "<BR/>"); // (r.gonet 03/07/2013) - PLID 43599 - If the setting is disabled, preserve consecutive whitespace. if(GetRemotePropertyInt("LabReportViewTrimExtraSpaces", TRUE) == FALSE) { strFieldValue.Replace(" ", "&nbsp;"); } else { // The browser will trim the spaces. } strHTML += FormatString("\t\t\t\t\t\t<span class=\"MinorInfo\"> %s </span> \r\n", strFieldValue); strHTML += "\t\t\t\t\t</div>\r\n"; strHTML += "\t\t\t\t</td>\r\n"; return strHTML; } else { //TES 2/24/2012 - PLID 44841 - Just output a blank column of the width we were given. return FormatString("<td colspan=\"1\"><div style=\"width:%ipx;text-align:left;vertical-align:top;\"></div></td>", nColumnWidth); } } // (j.gruber 2010-11-30 09:14) - PLID 41653 CString CLabResultsTabDlg::GetResultHTML(NXDATALIST2Lib::IRowSettingsPtr pResultRow) { //first let's Generate our HTML script CString strHTML; //TES 9/10/2013 - PLID 58511 - If this result has been replaced, put a warning at the very top //TES 11/5/2013 - PLID 59320 - Actually, instead we're just going to not include it in the HTML if(VarBool(pResultRow->GetValue(lrtcExtraValue),FALSE)) { //strHTML += "<H2> WARNING: This result has been replaced by a subsequent result, and should be ignored </H2>\r\n"; return ""; } //first the main table strHTML += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed\">"; long nColumnCount = GetColumnCount(); long nColumnWidth = (nColumnCount==0)?0:GetBrowserWidth()/nColumnCount; for(int i = 0; i < nColumnCount; i++) { strHTML += FormatString("<col width=%i>", nColumnWidth); } strHTML += "<tr>"; for(int i = 0; i < nColumnCount; i++) { strHTML += FormatString("<td><div style=\"width:%i;height=0;\"></div></td>", nColumnWidth); } strHTML += "</tr>"; //TES 2/24/2012 - PLID 44841 - Make sure we've loaded the positions of all the result fields. EnsureResultFieldPositions(); //TES 2/24/2012 - PLID 44841 - Now, go through all our result field positions (which will have been sorted in the order they need to be // output), and add the HTML for each. int nCurrentRow = 0; CString strCurrentRowHTML; bool bCurrentRowHasData = false; CString strCurrentFieldHTML; int nCurrentFieldColumn = -1; for(int i = 0; i < m_arResultFieldPositions.GetSize(); i++) { ResultFieldPosition rfp = m_arResultFieldPositions[i]; //TES 3/27/2012 - PLID 49209 - Check whether we're actually showing this field. if(rfp.bShowField) { //TES 2/24/2012 - PLID 44841 - Are we on a new row? if(rfp.nRow > nCurrentRow) { nCurrentRow = rfp.nRow; //TES 2/24/2012 - PLID 44841 - Did the previous row have any data? if(bCurrentRowHasData) { //TES 2/24/2012 - PLID 44841 - Close off the current field, it should span the rest of the columns. ASSERT(nCurrentFieldColumn > 0); int nColSpan = GetColumnCount()-nCurrentFieldColumn+1; strCurrentFieldHTML.Replace(FormatString("width:%ipx;", nColumnWidth), FormatString("width:%ipx;", nColumnWidth*nColSpan)); strCurrentFieldHTML.Replace("colspan=\"1\"", FormatString("colspan=\"%i\"", nColSpan)); strCurrentRowHTML += strCurrentFieldHTML; strCurrentFieldHTML = ""; nCurrentFieldColumn = -1; //TES 2/24/2012 - PLID 44841 - Close off the current row. strCurrentRowHTML += "</tr>"; strHTML += strCurrentRowHTML; strCurrentRowHTML = "<tr>"; bCurrentRowHasData = false; } //TES 2/24/2012 - PLID 44841 - If the next field doesn't start at the beginning, add a blank cell spanning the columns in the // next row which don't have fields. if(rfp.nActualColumn > 1) { strCurrentRowHTML += FormatString("<td colspan=\"%i\"><div style=\"width:%ipx;text-align:left;vertical-align:top;\"></div></td>", (rfp.nActualColumn-1), nColumnWidth*(rfp.nActualColumn-1)); } //TES 2/24/2012 - PLID 44841 - Load the next field. bool bFieldHasData = false; CString strFieldHTML = GetResultFieldHTML(pResultRow, rfp, bFieldHasData, nColumnWidth); if(bFieldHasData) { //TES 2/24/2012 - PLID 44841 - The field has data, that means that this row has data bCurrentRowHasData = true; } //TES 2/24/2012 - PLID 44841 - Remember this information, so we can close off this field when we find the next valid one. // Because we're at the beginning of a row, we treat this as a field even if it's empty. strCurrentFieldHTML = strFieldHTML; nCurrentFieldColumn = rfp.nActualColumn; } else { //TES 2/24/2012 - PLID 44841 - Load the next field. bool bFieldHasData = false; CString strFieldHTML = GetResultFieldHTML(pResultRow, rfp, bFieldHasData, nColumnWidth); if(bFieldHasData) { //TES 2/24/2012 - PLID 44841 - Close off our previous field. It should span from wherever it started to here. ASSERT(nCurrentFieldColumn > 0); int nColSpan = rfp.nActualColumn-nCurrentFieldColumn; strCurrentFieldHTML.Replace(FormatString("width:%ipx;", nColumnWidth), FormatString("width:%ipx;", nColumnWidth*nColSpan)); strCurrentFieldHTML.Replace("colspan=\"1\"", FormatString("colspan=\"%i\"", nColSpan)); strCurrentRowHTML += strCurrentFieldHTML; strCurrentFieldHTML = strFieldHTML; nCurrentFieldColumn = rfp.nActualColumn; bCurrentRowHasData = true; } } } } //TES 2/24/2012 - PLID 44841 - Close off our previous field. It should span from wherever it started to the end of the row. int nColSpan = nColumnCount-nCurrentFieldColumn+1; strCurrentFieldHTML.Replace(FormatString("width:%ipx;", nColumnWidth), FormatString("width:%ipx;", nColumnWidth*nColSpan)); strCurrentFieldHTML.Replace("colspan=\"1\"", FormatString("colspan=\"%i\"", nColSpan)); strCurrentRowHTML += strCurrentFieldHTML; if(bCurrentRowHasData) { //TES 2/24/2012 - PLID 44841 - Close off the current row. strCurrentRowHTML += "</tr>"; strHTML += strCurrentRowHTML; } //TES 2/24/2012 - PLID 44841 - Close off the table strHTML += "</table>"; strHTML += "\t\t<div class=\"InnerTable\"> \r\n"; //next row contains Result Comments CString strTemp; //Result Comments CString strComments = VarString(GetTreeValue(pResultRow, lrfComments,lrtcValue), ""); if (!strComments.IsEmpty()) { strHTML += "\t\t\t<div class=\"InnerRow\">\r\n"; strHTML += "\t\t\t\t<div class=\"InnerCell\">\r\n"; strHTML += "\t\t\t\t\t<div id=\"Comments\"> "; strHTML += "\t\t\t\t\t\t<span class=\"MinorTitle\"> Comments: </span> \r\n"; // (r.gonet 07/26/2013) - PLID 57751 - Escape the value does not include any syntax characters. strComments = ConvertToQuotableXMLString(strComments); strComments.Replace("\r\n", "<BR/>"); // (r.gonet 03/07/2013) - PLID 43599 - If the setting is disabled, then preserve consecutive whitespace. if(GetRemotePropertyInt("LabReportViewTrimExtraSpaces", TRUE) == FALSE) { strComments.Replace(" ", "&nbsp;"); } else { // The browser will trim the extra spaces. } strTemp.Format("\t\t\t\t\t\t<span class=\"MinorInfo\"> %s </span> \r\n", strComments); strHTML += strTemp; strHTML += "\t\t\t\t\t</div>"; //close the Cell strHTML += "\t\t\t\t</div>\r\n"; //close the Row strHTML += "\t\t\t</div>\r\n"; } //and last the values long nMailID = VarLong(GetTreeValue(pResultRow, lrfValue,lrtcForeignKeyID),-1); CString strValue = VarString(GetTreeValue(pResultRow, lrfValue,lrtcValue), ""); if (!strValue.IsEmpty()) { strHTML += "\t\t\t<div class=\"InnerRow\">\r\n"; strHTML += "\t\t\t\t<div class=\"InnerCell\">\r\n"; strHTML += "\t\t\t\t\t<div id=\"Value\"> "; strHTML += "\t\t\t\t\t\t<span class=\"MinorTitle\"> Value: </span> \r\n"; // (r.gonet 07/26/2013) - PLID 57751 - Escape the value does not include any syntax characters. strValue = ConvertToQuotableXMLString(strValue); if(strValue.Replace("\r\n", "<BR/>") > 0) { // (r.gonet 03/07/2013) - PLID 43599 - A multiline value is almost always a paragraph or a tabular form of data. // It should not be on the same line. Things like blood work usually take one line though and are best visible as a single line. strValue = "<BR/>" + strValue; } // (r.gonet 03/07/2013) - PLID 43599 - If the setting is disabled, then preserve consecutive spaces. if(GetRemotePropertyInt("LabReportViewTrimExtraSpaces", TRUE) == FALSE) { strValue.Replace(" ", "&nbsp;"); } else { // (r.gonet 03/07/2013) - PLID 43599 - The browser will trim the extra spaces. } strTemp.Format("\t\t\t\t\t\t<span class=\"MinorInfo\"> %s </span> \r\n", strValue); strHTML += strTemp; strHTML += "\t\t\t\t\t</div>"; //close the Cell strHTML += "\t\t\t\t</div>"; //close the Row strHTML += "\t\t\t</div>"; } //close it off strHTML += "\t\t\t<div class=\"InnerRow\">\r\n"; strHTML += "\t\t\t\t<div class=\"InnerCellWithBorder\">\r\n"; strHTML += "\t\t\t\t\t<div id=\"End\"> "; strHTML += "\t\t\t\t\t\t<span class=\"MinorTitle\"> </span> \r\n"; strTemp.Format("\t\t\t\t\t\t<span class=\"MinorInfo\"> </span> \r\n"); strHTML += strTemp; strHTML += "\t\t\t\t\t</div>"; //close the Cell strHTML += "\t\t\t\t</div>"; //close the Row strHTML += "\t\t\t</div>"; strHTML += "\t\t</div> \r\n"; return strHTML; } BOOL CLabResultsTabDlg::IsVerticalScrollBarVisible() { SCROLLBARINFO sbi; sbi.cbSize = sizeof(SCROLLBARINFO); long hwbrowser; m_pBrowser->get_HWND(&hwbrowser); ::GetScrollBarInfo((HWND)hwbrowser, OBJID_VSCROLL, &sbi); return ((sbi.rgstate[0] & STATE_SYSTEM_INVISIBLE) == 0); } //TES 2/24/2012 - PLID 44841 - Split out the code to calculate the width of the browser window into its own function. long CLabResultsTabDlg::GetBrowserWidth() { //get the width of the window we have CRect rcBrowser; GetDlgItem(IDC_PDF_PREVIEW)->GetWindowRect(rcBrowser); ScreenToClient(rcBrowser); long nWidth = rcBrowser.Width(); //if (IsVerticalScrollBarVisible()) { //subtract 50 to take care of the scrollbar and some padding nWidth -= 40; //} return nWidth; } // (j.gruber 2010-11-30 09:14) - PLID 41653 CString CLabResultsTabDlg::GetStyle() { //TES 2/24/2012 - PLID 44841 - Split GetBrowserWidth() into its own function long nWidth = GetBrowserWidth(); CString strStyle; CString strTemp; strStyle += "<style>\r\n"; // (j.gruber 2010-12-08 11:22) - PLID 41759 strStyle += "\tH1\r\n"; strStyle += "\t{\r\n"; strStyle += "\t\ttext-align: center;\r\n"; strStyle += "\t\tcolor:green;\r\n"; strStyle += "\t}\r\n"; //TES 9/10/2013 - PLID 58511 - We'll use H2 to warn on replaced records strStyle += "\tH2\r\n"; strStyle += "\t{\r\n"; strStyle += "\t\ttext-align: center;\r\n"; strStyle += "\t\tcolor:red;\r\n"; strStyle += "\t}\r\n"; strStyle += "\t.FullTable\r\n"; strStyle += "\t{\r\n"; strTemp.Format("\t\twidth: %lipx;\r\n", nWidth); strStyle += strTemp; strStyle += "\t\tborder: 1px;\r\n"; strStyle += "\t}\r\n"; strStyle += "\t.InnerRow\r\n"; strStyle += "\t{\r\n"; strTemp.Format("\t\twidth: %lipx;\r\n", nWidth); strStyle += strTemp; strStyle += "\t}\r\n"; //TES 2/24/2012 - PLID 44841 - Find out how many columns we need, and thus the width of each column long nColumns = GetColumnCount(); int nColumnWidth = (nColumns==0)?0:nWidth/nColumns; strStyle += "\ttable\r\n"; strStyle += "\t{\r\n"; strStyle += FormatString("\t\twidth: %lipx;\r\n", nWidth); strStyle += "\t}\r\n"; strStyle += "\ttd\r\n"; strStyle += "\t{\r\n"; strStyle += "\t\tvertical-align:top;\r\n"; strStyle += FormatString("\t\twidth: %li px;\r\n", nColumnWidth); strStyle += "\t}\r\n"; //TES 2/24/2012 - PLID 44841 - We don't use the HalfInnerCell styles any more strStyle += "\t.InnerCell\r\n"; strStyle += "\t{\r\n"; strTemp.Format("\t\twidth: %lipx;\r\n", nWidth); strStyle += strTemp; strStyle += "float: center;\r\n"; strStyle += "padding-top: 5px;\r\n"; strStyle += "colspan: 2;\r\n"; strStyle += "\t}\r\n"; strStyle += "\t.InnerCellWithBorder\r\n"; strStyle += "\t{\r\n"; strTemp.Format("\t\twidth: %lipx;\r\n", nWidth); strStyle += strTemp; strStyle += "padding-top: 5px;\r\n"; strStyle += "border-bottom: solid black;\r\n"; strStyle += "float: center;\r\n"; strStyle += "colspan: 2;\r\n"; strStyle += "\t}\r\n"; strStyle += "\t.MinorTitle\r\n"; strStyle += "\t{\r\n"; strStyle += "\t\tfont-family: Verdana;\r\n"; strStyle += "\t\tfont-size: 14px;\r\n"; strStyle += "\t\tcolor: blue;\r\n"; strStyle += "\t}\r\n"; // (r.gonet 03/07/2013) - PLID 44465 - Depending on the setting, use either a monospaced font like Courier New or a proportial font like Verdana for the values. CString strMinorInfoFontName = GetRemotePropertyInt("LabReportViewFontType", (long)lrvftProportional) == lrvftMonospaced ? "Courier New" : "Verdana"; strStyle += "\t.MinorInfo\r\n"; strStyle += "\t{\r\n"; strStyle += FormatString("\t\tfont-family: '%s';\r\n", strMinorInfoFontName); strStyle += "\t\tfont-size: 14px;\r\n"; strStyle += "\t\tcolor: black;\r\n"; strStyle += "\t}\r\n"; strStyle += "</style> \r\n"; return strStyle; } // (j.gruber 2010-11-30 09:14) - PLID 41606 NXDATALIST2Lib::IRowSettingsPtr CLabResultsTabDlg::GetSpecFromCurrentRow(NXDATALIST2Lib::IRowSettingsPtr pRow) { //we are given a row, we need to send back its Specimen Row //we lucked out and only the specimen rows have values in lrtcSpecimen, so we can just check for that //first, let's check out our Specimen for this row if (pRow) { _variant_t varSpecimen = pRow->GetValue(lrtcSpecimen); if (varSpecimen.vt == VT_BSTR) { //we are on the specimen row return pRow; } else { //let's look at the parent NXDATALIST2Lib::IRowSettingsPtr pParentRow = pRow->GetParentRow(); if (pParentRow) { varSpecimen = pParentRow->GetValue(lrtcSpecimen); if (varSpecimen.vt == VT_BSTR) { //we found it, return! return pParentRow; } else { //look at the grandparent NXDATALIST2Lib::IRowSettingsPtr pGRow = pParentRow->GetParentRow(); if (pGRow) { varSpecimen = pGRow->GetValue(lrtcSpecimen); if (varSpecimen.vt == VT_BSTR) { return pGRow; } else { //we should have found it by now ASSERT(FALSE); return NULL; } } } } } } //if we got here, we failed return NULL; } // (j.gruber 2010-11-30 09:11) - PLID 41607 void CLabResultsTabDlg::OnBnClickedScrollLeft() { // (j.gruber 2011-02-18 14:40) - PLID 41606, changed it to be the reverse of the tree // (d.singleton 2012-09-19 14:31) - PLID 42596, changed the way the tree loads so needed to change this back to not be reverse of tree try { //first get the specimen row that we are currently on IRowSettingsPtr pRow = m_pResultsTree->CurSel; NXDATALIST2Lib::IRowSettingsPtr pSpecRow = NULL; if (pRow) { pSpecRow = GetSpecFromCurrentRow(pRow); if (pSpecRow) { //go to its previous sibling NXDATALIST2Lib::IRowSettingsPtr pPrevRow = pSpecRow->GetPreviousRow(); if (pPrevRow) { m_pResultsTree->CurSel = pPrevRow; //we'll need to reload the row LoadResult(pPrevRow); //we are good to go, so refresh the report LoadHTMLReport(pPrevRow); //now update our buttons UpdateScrollButtons(); } } } }NxCatchAll(__FUNCTION__); } // (j.gruber 2010-11-30 09:11) - PLID 41607 void CLabResultsTabDlg::OnBnClickedScrollRight() { // (j.gruber 2011-02-18 14:40) - PLID 41606, changed it to be the reverse of the tree // (d.singleton 2012-09-19 14:31) - PLID 42596, changed the way the tree loads so needed to change this back to not be reverse of tree try { //first get the specimen row that we are currently on IRowSettingsPtr pRow = m_pResultsTree->CurSel; NXDATALIST2Lib::IRowSettingsPtr pSpecRow = NULL; if (pRow) { pSpecRow = GetSpecFromCurrentRow(pRow); if (pSpecRow) { //go to its previous sibling NXDATALIST2Lib::IRowSettingsPtr pNextRow = pSpecRow->GetNextRow(); if (pNextRow) { m_pResultsTree->CurSel = pNextRow; //we'll need to reload the row LoadResult(pNextRow); //we are good to go, so refresh the report LoadHTMLReport(pNextRow); //now update our buttons UpdateScrollButtons(); } } } }NxCatchAll(__FUNCTION__); } // (c.haag 2010-12-10 13:53) - PLID 37372 - Given an arbitrary row, this function will try to get the parent lab row, and // then the result row out of it if one and only one exists. IRowSettingsPtr CLabResultsTabDlg::GetFirstAndOnlyLabResultRow(IRowSettingsPtr pRow) { // See if we have a lab row selected IRowSettingsPtr pLabRow = GetLabRow(pRow); if (NULL == pLabRow) { // No lab return NULL; } // If there is a lab, and it has only one result, return it. if (NULL != pLabRow->GetFirstChildRow() && NULL == pLabRow->GetFirstChildRow()->GetNextRow()) { return pLabRow->GetFirstChildRow(); } else { // No results or multiple results return NULL; } } // (c.haag 2010-12-06 13:48) - PLID 41618 - Handler for the left result scroll button in the PDF view void CLabResultsTabDlg::OnBnClickedResultScrollLeft() { try { if(m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnBnClickedResultScroll(-1); } else { ThrowNxException("Called CLabResultsTabDlg::OnBnClickedResultScrollLeft without a valid attachment view!"); } } else { ThrowNxException("Called CLabResultsTabDlg::OnBnClickedResultScrollLeft outside the attachment view!"); } } NxCatchAll(__FUNCTION__); } // (c.haag 2010-12-06 13:48) - PLID 41618 - Handler for the right result scroll button in the PDF view void CLabResultsTabDlg::OnBnClickedResultScrollRight() { try { if(m_nCurrentView == rvPDF) { if (NULL != m_pLabResultsAttachmentView) { m_pLabResultsAttachmentView->OnBnClickedResultScroll(1); } else { ThrowNxException("Called CLabResultsTabDlg::OnBnClickedResultScrollRight without a valid attachment view!"); } } else { ThrowNxException("Called CLabResultsTabDlg::OnBnClickedResultScrollRight outside the attachment view!"); } } NxCatchAll(__FUNCTION__); } // (j.gruber 2010-11-30 09:11) - PLID 41607 void CLabResultsTabDlg::UpdateScrollButtons() { try { //first get the specimen row that we are currently on IRowSettingsPtr pRow = m_pResultsTree->CurSel; NXDATALIST2Lib::IRowSettingsPtr pSpecRow = NULL; if (pRow) { pSpecRow = GetSpecFromCurrentRow(pRow); if (pSpecRow) { //is there a previous Spec Row NXDATALIST2Lib::IRowSettingsPtr pTempRow = pSpecRow->GetPreviousRow(); if (pTempRow) { //enable the button // (j.gruber 2011-02-18 14:42) - PLID 41606 - reverse it frm the tree // (d.singleton 2012-09-19 14:31) - PLID 42596 changed the way the tree loads so needed to change this back to not be reverse of tree GetDlgItem(IDC_SCROLL_LEFT)->EnableWindow(TRUE); } else { GetDlgItem(IDC_SCROLL_LEFT)->EnableWindow(FALSE); } //now check the next row pTempRow = pSpecRow->GetNextRow(); if (pTempRow) { //enable the button GetDlgItem(IDC_SCROLL_RIGHT)->EnableWindow(TRUE); } else { GetDlgItem(IDC_SCROLL_RIGHT)->EnableWindow(FALSE); } } } }NxCatchAll(__FUNCTION__); } // (c.haag 2011-02-22) - PLID 41618 - All detach/filename button toggles are now centralized here void CLabResultsTabDlg::UpdateDetachButton() { BOOL bInReportView = ((CButton *)GetDlgItem(IDC_REPORTVIEW_RADIO))->GetCheck(); BOOL bInPDFView = ((CButton *)GetDlgItem(IDC_PDFVIEW_RADIO))->GetCheck(); if (bInReportView) { // These should not be visible in the report view GetDlgItem(IDC_ATTACH_FILE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_DETACH_FILE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_DOC_PATH_LINK)->ShowWindow(SW_HIDE); } else if (bInPDFView) { // The attachment view handles this } else { // First, update just the document hyperlink if (!m_strCurrentFileName.IsEmpty()) { GetDlgItem(IDC_DOC_PATH_LINK)->ShowWindow(SW_SHOW); m_nxlDocPath.SetText(GetFileName(m_strCurrentFileName)); m_nxlDocPath.SetType(dtsHyperlink); InvalidateDlgItem(IDC_DOC_PATH_LINK); } else { GetDlgItem(IDC_DOC_PATH_LINK)->ShowWindow(SW_HIDE); } // Now update the button IRowSettingsPtr pResultRow = GetResultRow(m_pResultsTree->CurSel); if (NULL != pResultRow) { // We have a result row. Get its attachment. long nMailID = VarLong(GetTreeValue(pResultRow, lrfValue, lrtcForeignKeyID),-1); // If this is true, then we have an attachment, so show the detach button if(-1 != nMailID) { // (z.manning 2010-05-12 12:26) - PLID 37400 - We allow them to attach files to read-only results // but not detach files as it may have came from HL7. BOOL bEnableResults = TRUE; if(VarLong(pResultRow->GetValue(lrtcHL7MessageID), -1) != -1 && !CheckCurrentUserPermissions(bioPatientLabs, sptDynamic1, FALSE, 0, TRUE)) { bEnableResults = FALSE; } EnableResultWnd(bEnableResults, GetDlgItem(IDC_DETACH_FILE)); GetDlgItem(IDC_ATTACH_FILE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_DETACH_FILE)->ShowWindow(SW_SHOW); } // If this code block is called, the result has no attachment else { GetDlgItem(IDC_ATTACH_FILE)->ShowWindow(SW_SHOW); GetDlgItem(IDC_DETACH_FILE)->ShowWindow(SW_HIDE); } } else { // If we have no result selected, we can't attach or detach anything GetDlgItem(IDC_ATTACH_FILE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_DETACH_FILE)->ShowWindow(SW_HIDE); } } } // (c.haag 2011-02-22) - PLID 41618 - All zoom button toggles are now centralized here void CLabResultsTabDlg::UpdateZoomButton() { if (!m_strCurrentFileName.IsEmpty()) { m_btnZoom.EnableWindow(TRUE); } else { m_btnZoom.EnableWindow(FALSE); } } // (j.gruber 2010-11-30 09:14) - PLID 41607 void CLabResultsTabDlg::RefreshHTMLReportOnlyControls(BOOL bOnReportView) { //we only want to show the scroll buttons on the report view and we want to hide the zoom m_btnZoom.ShowWindow(!bOnReportView); m_btnScrollLeft.ShowWindow(bOnReportView); m_btnScrollRight.ShowWindow(bOnReportView); } // (j.gruber 2010-11-30 09:14) - PLID 41606 void CLabResultsTabDlg::UnloadHTMLReports() { try { //unload the pdf viewer COleVariant varUrl("about:blank"); if (m_pBrowser) { m_pBrowser->put_RegisterAsDropTarget(VARIANT_FALSE); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); } //go through our array and delete any files we created for (int i = m_straryLabReports.GetSize() - 1; i >= 0; i--) { if (DeleteFile(m_straryLabReports.GetAt(i))) { m_straryLabReports.RemoveAt(i); } } }NxCatchAll(__FUNCTION__); } // (j.gruber 2010-11-30 09:14) - PLID 41606 void CLabResultsTabDlg::ReloadCurrentPDF() { CString strFileName = m_strCurrentFileName; if (strFileName.IsEmpty()) { strFileName = "about:blank"; } //TES 11/23/2009 - PLID 36192 - If this is a .pdf file, we want to append #toolbar=0, to hide the .pdf controls. if(strFileName.Right(4).CompareNoCase(".pdf") == 0) { strFileName += "#toolbar=0"; } COleVariant varUrl(strFileName); // (a.walling 2011-04-29 08:26) - PLID 43501 - Bypass navigation cache m_pBrowser->Navigate2(varUrl, COleVariant((long)(navNoHistory|navNoReadFromCache|navNoWriteToCache)), NULL, NULL, NULL); GetDlgItem(IDC_PDF_PREVIEW)->EnableWindow(TRUE); } // (c.haag 2010-12-15 16:34) - PLID 41825 - If the lab is completed, this returns the user who completed it. // (c.haag 2011-01-27) - PLID 41825 - I deprecated the need for this code; but I'm keeping it commented out // because it may come in handy someday and may even help developers better understand the lab code. /*BOOL CLabResultsTabDlg::IsLabCompleted(long nLabID, OUT long& nCompletedBy, COleDateTime& dtCompletedDate) { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return FALSE; // No lab, no results } IRowSettingsPtr pResultRow = pLabRow->GetFirstChildRow(); if (NULL == pResultRow) { return FALSE; // No results } nCompletedBy = -1; while (pResultRow) { long nUserID; COleDateTime dt; if (-1 == (nUserID = VarLong(pResultRow->GetValue(lrtcCompletedBy), -1))) { return FALSE; // Result is not complete } else { // Result was completed dt = VarDateTime(pResultRow->GetValue(lrtcCompletedDate)); if (-1 == nCompletedBy || (nCompletedBy > -1 && dt > dtCompletedDate)) { // If we get here, either this is the first result or this result has a more recent completed // date, so update the outputs. dtCompletedDate = dt; nCompletedBy = nUserID; } } pResultRow = pResultRow->GetNextRow(); } // At least one result exists and is marked complete return TRUE; }*/ // (c.haag 2010-12-15 16:34) - PLID 41825 - Returns TRUE if this lab has any unsigned results // (c.haag 2011-01-27) - PLID 41825 - I deprecated the need for this code; but I'm keeping it commented out // because it may come in handy someday and may even help developers better understand the lab code. /*BOOL CLabResultsTabDlg::LabHasUnsignedResults(long nLabID) { IRowSettingsPtr pLabRow = GetLabRowByID(nLabID); if (NULL == pLabRow) { return FALSE; // No lab, no signatures } IRowSettingsPtr pResultRow = pLabRow->GetFirstChildRow(); while (pResultRow) { if (pResultRow->GetValue(lrtcSignatureInkData).vt == VT_NULL) { return TRUE; // This result is unsigned } pResultRow = pResultRow->GetNextRow(); } return FALSE; // The lab has no results or all results are signed }*/ // (j.dinatale 2010-12-22) - PLID 41591 - Event handle for the view notes button void CLabResultsTabDlg::OnViewNotes() { try { // set up a notes dialog with no auto added note SetUpNotesDlg(false); } NxCatchAll(__FUNCTION__); } // (j.dinatale 2010-12-22) - PLID 41591 - Event handle for the add note button void CLabResultsTabDlg::OnAddNote() { try { // set up a notes dialog with an auto added note SetUpNotesDlg(true); } NxCatchAll(__FUNCTION__); } // (j.dinatale 2010-12-23) - PLID 41591 - utility function to set up the notes dialog accordingly void CLabResultsTabDlg::SetUpNotesDlg(bool bAutoAddNewNote) { // if in discrete view if (m_nCurrentView == rvDiscreteValues) { // try to get a result row IRowSettingsPtr pResultRow = GetResultRow(m_pResultsTree->CurSel); if(pResultRow){ // if we got a result row, show the results form of the notes dlg ShowNotesDlgForResult(pResultRow, bAutoAddNewNote); }else{ // otherwise try and find the lab row IRowSettingsPtr pLabRow = GetLabRow(m_pResultsTree->CurSel); if(pLabRow){ // if we got the lab row, try and show the lab notes form of the notes dlg ShowNotesDlgForLab(pLabRow, bAutoAddNewNote); } } } // if we are in the report view else if (m_nCurrentView == rvNexTechReport) { // try and get the lab row IRowSettingsPtr pLabRow = GetLabRow(m_pResultsTree->CurSel); if(pLabRow){ // if we got the row, show the lab notes form of the notes dlg ShowNotesDlgForLab(pLabRow, bAutoAddNewNote); } } // else we are in pdf view else if (m_nCurrentView == rvPDF) { // (c.haag 2011-02-22) - PLID 41618 - Forward to the attachments view if (NULL == m_pLabResultsAttachmentView) { ThrowNxException("Called CLabResultsTabDlg::SetUpNotesDlg without a valid attachment view!"); } else { m_pLabResultsAttachmentView->SetUpNotesDlg(bAutoAddNewNote); } } } // (j.dinatale 2010-12-22) - PLID 41591 - Function to display the notesdlg configured for a result void CLabResultsTabDlg::ShowNotesDlgForResult(IRowSettingsPtr pResultRow, bool bAutoAddNewNote) { try{ // check if we have a valid row passed if(pResultRow){ // we are going to force a save, we cannot have notes added to a lab and then the user hitting cancel if(!m_pLabEntryDlg->Save()){ return; } // grab the result ID long nResultID = VarLong(pResultRow->GetValue(lrtcResultID), -1); // construct the notes dlg CNotesDlg dlgLabNotes(this); // assign it a lab result ID, a the patient ID, tell it that its displaying lab notes, and the color to use dlgLabNotes.SetPersonID(m_nPatientID); dlgLabNotes.m_nLabResultID = nResultID; dlgLabNotes.m_bIsLabNotes = true; dlgLabNotes.m_clrLabNote = ((CNxColor *)GetDlgItem(IDC_LABRESULTSVIEW_NXCOLORCTRL))->GetColor(); // now attempt to get a lab row from the result row IRowSettingsPtr pLabRow = GetLabRow(pResultRow); CString strPrependToNote = ""; // if we got a row... if(pLabRow){ // get the lab ID long nLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID), -1); // if the id is not -1, go ahead and assign the lab ID to the notes dlg if(nLabID != -1){ dlgLabNotes.m_nLabID = nLabID; } // also attempt to get the lab name CString strLabName = VarString(pLabRow->GetValue(lrtcValue), ""); // if we have a lab name, we want to have it as part of the prepended text if(!strLabName.IsEmpty()){ strPrependToNote += "(Form # " + strLabName + ")"; } } // attempt to get the result name CString strResultName = VarString(GetTreeValue(pResultRow, lrfName, lrtcValue), ""); // check if we have a result name, if so, added it to the prepend text in the proper formatting if(!strResultName.IsEmpty()){ if(!strPrependToNote.IsEmpty()){ strPrependToNote += ": "; } strPrependToNote += strResultName; } // give it to the notes dialog dlgLabNotes.m_strPrependText = strPrependToNote; // (j.dinatale 2011-08-12 15:00) - PLID 44861 - we were passing in a user name, that shouldnt happen because this is a global preference! // (j.dinatale 2011-01-03) - PLID 41966 - provide a category override dlgLabNotes.m_nCategoryIDOverride = GetRemotePropertyInt("LabNotesDefaultCategory",-1,0,"<None>",true); // tell the dialog whether or not it should have a new note ready to be typed into dlgLabNotes.m_bAutoAddNoteOnShow = bAutoAddNewNote; // display it as a modal dialog CNxModalParentDlg dlg(this, &dlgLabNotes, CString("Lab Result Notes: " + strPrependToNote)); dlg.DoModal(); // format the note buttons afterwards FormatNotesButtonsForResult(pResultRow); } }NxCatchAll(__FUNCTION__); } // (j.dinatale 2010-12-22) - PLID 41591 - Function to display the notes for an entire lab/specimen void CLabResultsTabDlg::ShowNotesDlgForLab(IRowSettingsPtr pLabRow, bool bAutoAddNewNote) { try{ // if a row was passed in if(pLabRow){ // we are going to prepend text CString strPrependToNote = ""; // we are going to force a save, we cannot have notes added to a lab and then the user hitting cancel if(!m_pLabEntryDlg->Save()){ return; } // get the lab ID long nLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID), -1); // get the lab name CString strLabName = VarString(pLabRow->GetValue(lrtcValue), ""); // if the lab name is not empty, go ahead and added it to our prepended text if(!strLabName.IsEmpty()){ strPrependToNote += "(Form # " + strLabName + ")"; } // create the notes dialog CNotesDlg dlgLabNotes(this); // set the person ID, lab ID, let the dialog know its for a lab and assign the color. Pass in the prepend text too. dlgLabNotes.SetPersonID(m_nPatientID); dlgLabNotes.m_nLabID = nLabID; dlgLabNotes.m_bIsLabNotes = true; dlgLabNotes.m_clrLabNote = ((CNxColor *)GetDlgItem(IDC_LABRESULTSVIEW_NXCOLORCTRL))->GetColor(); dlgLabNotes.m_strPrependText = strPrependToNote; // (j.dinatale 2011-08-12 15:00) - PLID 44861 - we were passing in a user name, that shouldnt happen because this is a global preference! // (j.dinatale 2011-01-03) - PLID 41966 - provide a category override dlgLabNotes.m_nCategoryIDOverride = GetRemotePropertyInt("LabNotesDefaultCategory",-1,0,"<None>",true); // tell the dialog whether or not it should have a new note ready to be typed into dlgLabNotes.m_bAutoAddNoteOnShow = bAutoAddNewNote; // display it as a modal dialog CNxModalParentDlg dlg(this, &dlgLabNotes, CString("Lab Specimen Notes: " + strPrependToNote)); dlg.DoModal(); // format the note buttons afterwards FormatNotesButtonsForLab(pLabRow); } }NxCatchAll(__FUNCTION__); } // (j.dinatale 2010-12-22) - PLID 41591 - Function to get the result row an attachment or file is attached to NXDATALIST2Lib::IRowSettingsPtr CLabResultsTabDlg::GetResultRowFromAttachment(CString strFullFilePath) { try{ // if the file path is empty, then just return NULL if(strFullFilePath.IsEmpty()){ return NULL; } IRowSettingsPtr pResultRowOfFile = NULL; // loop through each key POSITION posMain = m_mapAttachedFiles.GetStartPosition(); while(posMain != NULL) { // get the associated items for the key one by one LPDISPATCH lpKey; CMap<LPDISPATCH,LPDISPATCH,CString,CString&>* pmapFiles; m_mapAttachedFiles.GetNextAssoc(posMain, lpKey, pmapFiles); POSITION posTemp = pmapFiles->GetStartPosition(); while(posTemp != NULL) { CString strFile; pmapFiles->GetNextAssoc(posTemp, lpKey, strFile); CString strFullPath; // make sure we are looking at the full path of the file, the map stores file names sometimes if(strFile.Find("\\") == -1){ strFullPath = GetPatientDocumentPath(m_nPatientID) ^ strFile; }else{ strFullPath = strFile; } // if the file path is the same as the one passed in, this is the row we want if(strFullFilePath == strFullPath) { return (NXDATALIST2Lib::IRowSettingsPtr) lpKey; } } } }NxCatchAll(__FUNCTION__); // if an exception happens, or we dont find anything, return null return NULL; } // (j.dinatale 2011-01-03) - PLID 41591 - added exception handling just in case // (j.dinatale 2010-12-27) - PLID 41591 - Function to format buttons based on a result row in the result tree void CLabResultsTabDlg::FormatNotesButtonsForResult(NXDATALIST2Lib::IRowSettingsPtr pResultRow) { try{ if(pResultRow){ // grab the result ID long nResultID = VarLong(pResultRow->GetValue(lrtcResultID), -1); // check if there are any result notes if(nResultID > 0 && ReturnsRecordsParam("SELECT 1 FROM Notes WHERE LabResultID = {INT}", nResultID)){ // if they are, the text of the view notes button should be red and have the red notes icon (like the billing tab) m_btnNotes.AutoSet(NXB_EXTRANOTES); m_btnNotes.SetTextColor(RGB(255, 0, 0)); }else{ // otherwise, the normal note icon and black text m_btnNotes.AutoSet(NXB_NOTES); m_btnNotes.SetTextColor(RGB(0, 0, 0)); } // both buttons should be enabled GetDlgItem(IDC_LABNOTES)->EnableWindow(TRUE); GetDlgItem(IDC_ADDLABNOTE)->EnableWindow(TRUE); } }NxCatchAll(__FUNCTION__); } // (j.dinatale 2011-01-03) - PLID 41591 - added exception handling just in case // (j.dinatale 2010-12-27) - PLID 41591 - function to disable the note buttons void CLabResultsTabDlg::DisableNotesButtons() { try{ // set the button to have a normal note icon, black text and disable both note buttons m_btnNotes.AutoSet(NXB_NOTES); m_btnNotes.SetTextColor(RGB(0, 0, 0)); GetDlgItem(IDC_LABNOTES)->EnableWindow(FALSE); GetDlgItem(IDC_ADDLABNOTE)->EnableWindow(FALSE); }NxCatchAll(__FUNCTION__); } // (j.dinatale 2011-01-03) - PLID 41591 - added exception handling just in case // (j.dinatale 2010-12-27) - PLID 41591 - Function to format buttons based on a lab row in the result tree void CLabResultsTabDlg::FormatNotesButtonsForLab(NXDATALIST2Lib::IRowSettingsPtr pLabRow) { try{ if(pLabRow){ // get the lab ID long nLabID = VarLong(pLabRow->GetValue(lrtcForeignKeyID), -1); // check and see if there are any notes for the lab if(nLabID > 0 && ReturnsRecordsParam("SELECT 1 FROM Notes WHERE LabID = {INT}", nLabID)){ // if they are, the text of the view notes button should be red and have the red notes icon (like the billing tab) m_btnNotes.AutoSet(NXB_EXTRANOTES); m_btnNotes.SetTextColor(RGB(255, 0, 0)); }else{ // otherwise, the normal note icon and black text m_btnNotes.AutoSet(NXB_NOTES); m_btnNotes.SetTextColor(RGB(0, 0, 0)); } // both buttons should be enabled GetDlgItem(IDC_LABNOTES)->EnableWindow(TRUE); GetDlgItem(IDC_ADDLABNOTE)->EnableWindow(TRUE); } }NxCatchAll(__FUNCTION__); } // (j.dinatale 2010-12-27) - PLID 41591 - Function to format buttons based on any row in the result tree void CLabResultsTabDlg::FormatNotesButtons(NXDATALIST2Lib::IRowSettingsPtr pRow) { try{ // if in discrete view if(m_nCurrentView == rvDiscreteValues){ // try to get a result row IRowSettingsPtr pResultRow = GetResultRow(pRow); if(pResultRow){ // if we got a result row, format note buttons according to that result FormatNotesButtonsForResult(pResultRow); }else{ // (j.dinatale 2011-02-28) - PLID 41591 - should be getting the lab row corresponding to the row passed // in, not the current selection // otherwise try and find the lab row IRowSettingsPtr pLabRow = GetLabRow(pRow); if(pLabRow){ // if we got the lab row, format note buttons according to the lab FormatNotesButtonsForLab(pLabRow); }else{ // otherwise, assume we are disabling the note buttons DisableNotesButtons(); } } }else{ // if we are in the report view if(m_nCurrentView == rvNexTechReport){ // try and get the lab row IRowSettingsPtr pLabRow = GetLabRow(pRow); if(pLabRow){ // if we got the lab row, format note buttons according to the lab FormatNotesButtonsForLab(pLabRow); }else{ // otherwise assume we are disabling the note buttons DisableNotesButtons(); } } else { // if we are in the pdf viewer if(m_nCurrentView == rvPDF) { // (c.haag 2011-02-23) - PLID 41618 - The attachment view handles this } else { // we are not in pdf, report, or discrete views. It is likely the view is not set, so disable the buttons DisableNotesButtons(); } } } }NxCatchAll(__FUNCTION__); } // (c.haag 2011-02-22) - PLID 41618 - Returns attachment information for a given row CAttachedLabFile CLabResultsTabDlg::GetAttachedLabFile(LPDISPATCH lpRow) { CArray<CAttachedLabFile,CAttachedLabFile&> aAttachedFiles; GetAllAttachedFiles(aAttachedFiles); for (int i=0; i < aAttachedFiles.GetSize(); i++) { if (aAttachedFiles[i].lpRow == lpRow) { return aAttachedFiles[i]; } } CAttachedLabFile empty; return empty; } void CLabResultsTabDlg::OnEditOrderStatus() { try{ //TES 5/2/2011 - PLID 43428 - Added the ability for this dialog to edit Order statuses as well as Result statuses. CEditLabStatusDlg dlg(this); dlg.m_bEditOrderStatus = true; //TES 5/2/2011 - PLID 43428 - Temporarily save the current selection for later IRowSettingsPtr pRow = m_pOrderStatusCombo->GetCurSel(); long nValue = -1; if(pRow != NULL) { nValue = VarLong(pRow->GetValue(oscID), -1); } //TES 5/2/2011 - PLID 43428 - Bring up the dialog. dlg.DoModal(); //TES 5/2/2011 - PLID 43428 - Refresh the list, now that it's probably changed. m_pOrderStatusCombo->Requery(); //TES 12/4/2008 - PLID 32191 - Set the selection back to what it was m_pOrderStatusCombo->SetSelByColumn(oscID, nValue); }NxCatchAll(__FUNCTION__); } void CLabResultsTabDlg::OnConfigureReportView() { try { //TES 2/24/2012 - PLID 44841 - Pop up the dialog. CConfigureReportViewDlg dlg; if(IDOK == dlg.DoModal()) { //TES 2/24/2012 - PLID 44841 - Reload the Report View IRowSettingsPtr pRow = m_pResultsTree->CurSel; if (pRow) { NXDATALIST2Lib::IRowSettingsPtr pSpecRow = GetSpecFromCurrentRow(pRow); if (pSpecRow) { LoadHTMLReport(pSpecRow); } } } }NxCatchAll(__FUNCTION__); } //TES 2/24/2012 - PLID 44841 - Determines the actual number of columns that will be displayed in the report view, based on the configuration // as well as the field values for the current result. long CLabResultsTabDlg::GetColumnCount() { EnsureResultFieldPositions(); int nHighestColumn = 0; for(int i = 0; i < m_arResultFieldPositions.GetSize(); i++) { ResultFieldPosition rfp = m_arResultFieldPositions[i]; //TES 3/27/2012 - PLID 49209 - Don't count fields we aren't showing if(rfp.bShowField && rfp.nActualColumn > nHighestColumn) { nHighestColumn = rfp.nActualColumn; } } return nHighestColumn; } //TES 2/24/2012 - PLID 44841 - Fills m_arResultFieldPositions from ConfigRT, if necessary. void CLabResultsTabDlg::EnsureResultFieldPositions() { //TES 2/24/2012 - PLID 44841 - If these are already loaded, we're done. if(m_bLoadedResultFieldPositions) { return; } //TES 2/24/2012 - PLID 44841 - Clear out anything that's already in there. m_arResultFieldPositions.RemoveAll(); //TES 2/24/2012 - PLID 44841 - Now load each field out from ConfigRT (it uses the LabResultField enum as the Property number). // The default values roughly approximate how the report view looked prior to this change, although the HTML changes were significant, // so the appearance isn't precisely identical. ResultFieldPosition rfp; rfp.lrf = lrfName; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 1, lrfName, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfName, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfName, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfSlideNum; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 1, lrfSlideNum, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfSlideNum, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSlideNum, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfDateReceived; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 2, lrfDateReceived, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfDateReceived, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfDateReceived, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfLOINC; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 2, lrfLOINC, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfLOINC, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfLOINC, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfDateReceivedByLab; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 3, lrfDateReceivedByLab, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfDateReceivedByLab, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfDateReceivedByLab, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfDatePerformed; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 4, lrfDatePerformed, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfDatePerformed, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfDatePerformed, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfStatus; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 5, lrfStatus, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfStatus, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfStatus, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfUnits; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 5, lrfUnits, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfUnits, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfUnits, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfFlag; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 6, lrfFlag, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfFlag, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfFlag, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfReference; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 6, lrfReference, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfReference, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfReference, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfAcknowledgedBy; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 7, lrfAcknowledgedBy, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfAcknowledgedBy, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfAcknowledgedBy, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfDiagnosis; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 8, lrfDiagnosis, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfDiagnosis, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfDiagnosis, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfMicroscopicDescription; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 8, lrfMicroscopicDescription, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfMicroscopicDescription, "<None>"); //TES 3/26/2012 - PLID 49208 - Added an option to hide fields entirely rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfMicroscopicDescription, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-06-19 17:21) - PLID 57937 - Update HL7 lab messages to support latest MU requirements. need to display spm segment rfp.lrf = lrfSpecimenIdentifier; rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 9, lrfSpecimenIdentifier, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfSpecimenIdentifier, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSpecimenIdentifier, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfSpecimenIdText; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 9, lrfSpecimenIdText, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfSpecimenIdText, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSpecimenIdText, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfSpecimenStartTime; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 10, lrfSpecimenStartTime, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfSpecimenStartTime, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSpecimenStartTime, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfSpecimenEndTime; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 10, lrfSpecimenEndTime, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfSpecimenEndTime, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSpecimenEndTime, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfSpecimenRejectReason; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 11, lrfSpecimenRejectReason, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfSpecimenRejectReason, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSpecimenRejectReason, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfSpecimenCondition; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 11, lrfSpecimenCondition, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfSpecimenCondition, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfSpecimenCondition, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-08-07 17:10) - PLID 57600 - show CollectionStartTime and CollectionEndTime in the html view of lab results rfp.lrf = lrfServiceStartTime; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 12, lrfServiceStartTime, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfServiceStartTime, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfServiceStartTime, "<None>"); m_arResultFieldPositions.Add(rfp); rfp.lrf = lrfServiceEndTime; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 12, lrfServiceEndTime, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfServiceEndTime, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfServiceEndTime, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-08-07 17:11) - PLID 57912 - need to show the Performing Provider on report view of labresult tab dlg rfp.lrf = lrfPerformingProvider; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 13, lrfPerformingProvider, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerformingProvider, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerformingProvider, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-04 17:09) - PLID 59294 - add observation date to the html view for lab results. rfp.lrf = lrfObservationDate; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 13, lrfObservationDate, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 2, lrfObservationDate, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfObservationDate, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-10-25 13:53) - PLID 59181 - need new option to pull performing lab from obx23 and show on the html view rfp.lrf = lrfPerformingLab; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 14, lrfPerformingLab, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerformingLab, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerformingLab, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-06 14:52) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs rfp.lrf = lrfPerfLabAddress; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 15, lrfPerfLabAddress, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerfLabAddress, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerfLabAddress, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-06 14:52) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs rfp.lrf = lrfPerfLabCity; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 16, lrfPerfLabCity, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerfLabCity, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerfLabCity, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-06 14:52) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs rfp.lrf = lrfPerfLabState; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 17, lrfPerfLabState, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerfLabState, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerfLabState, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-06 14:52) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs rfp.lrf = lrfPerfLabZip; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 18, lrfPerfLabZip, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerfLabZip, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerfLabZip, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-06 14:52) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs rfp.lrf = lrfPerfLabCountry; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 19, lrfPerfLabCountry, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerfLabCountry, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerfLabCountry, "<None>"); m_arResultFieldPositions.Add(rfp); // (d.singleton 2013-11-06 14:52) - PLID 59337 - need the city, state, zip, parish code and country added to preforming lab for hl7 labs rfp.lrf = lrfPerfLabParish; rfp.nRow = rfp.nRow = GetRemotePropertyInt("LabReportViewFieldRow", 20, lrfPerfLabParish, "<None>"); rfp.nColumn = GetRemotePropertyInt("LabReportViewFieldColumn", 1, lrfPerfLabParish, "<None>"); rfp.bShowField = GetRemotePropertyInt("LabReportViewFieldShow", TRUE, lrfPerfLabParish, "<None>"); m_arResultFieldPositions.Add(rfp); //TES 2/24/2012 - PLID 44841 - Now we need to go through and find out which columns are actually used (based on the data for this result). CArray<long,long> arUsedColumns; for(int i = 0; i < m_arResultFieldPositions.GetSize(); i++) { ResultFieldPosition rfpCol = m_arResultFieldPositions[i]; //TES 3/27/2012 - PLID 49209 - Don't look at fields we aren't showing if(rfpCol.bShowField) { long nColumn = rfpCol.nColumn; bool bUsed = false; for(int j = 0; j < arUsedColumns.GetSize() && !bUsed; j++) { if(nColumn == arUsedColumns[j]) bUsed = true; } if(!bUsed) { NXDATALIST2Lib::IRowSettingsPtr pSpecRow = m_pResultsTree->GetFirstRow(); while(pSpecRow && !bUsed) { NXDATALIST2Lib::IRowSettingsPtr pResult = pSpecRow->GetFirstChildRow(); while(pResult && !bUsed) { _variant_t varValue = GetTreeValue(pResult, rfpCol.lrf, lrtcValue); if(varValue.vt != VT_NULL && varValue.vt != VT_EMPTY) { bUsed = true; } pResult = pResult->GetNextRow(); } pSpecRow = pSpecRow->GetNextRow(); } if(bUsed) { bool bInserted = false; for(int nUsedCol = 0; nUsedCol < arUsedColumns.GetSize() && !bInserted; nUsedCol++) { if(arUsedColumns[nUsedCol] > nColumn) { arUsedColumns.InsertAt(nUsedCol, nColumn); bInserted = true; } } if(!bInserted) { arUsedColumns.Add(nColumn); } } } } } //TES 2/24/2012 - PLID 44841 - Now update the nActualColumn variables to reflect any empty columns which we'll not be displaying. for(int i = 0; i < m_arResultFieldPositions.GetSize(); i++) { ResultFieldPosition rfp = m_arResultFieldPositions[i]; for(int j = 0; j < arUsedColumns.GetSize() && rfp.nActualColumn == -1; j++) { if(arUsedColumns[j] == rfp.nColumn) { rfp.nActualColumn = j+1; } } m_arResultFieldPositions.SetAt(i, rfp); } //TES 2/24/2012 - PLID 44841 - Now sort the array based on the order in which we're going to output the HTML CArray<ResultFieldPosition,ResultFieldPosition&> arSorted; for(int i = 0; i < m_arResultFieldPositions.GetSize(); i++) { ResultFieldPosition rfp = m_arResultFieldPositions[i]; bool bInserted = false; for(int j = 0; j < arSorted.GetSize() && !bInserted; j++) { ResultFieldPosition rfp2 = arSorted[j]; if(rfp2.nRow > rfp.nRow || (rfp2.nRow == rfp.nRow && rfp2.nColumn > rfp.nColumn)) { arSorted.InsertAt(j, rfp); bInserted = true; } } if(!bInserted) { arSorted.Add(rfp); } } m_arResultFieldPositions.RemoveAll(); m_arResultFieldPositions.Append(arSorted); for(int i = 0; i < m_arResultFieldPositions.GetSize(); i++) { TRACE("{%i, %i}\r\n", m_arResultFieldPositions[i].nRow, m_arResultFieldPositions[i].nActualColumn); } } // (j.dinatale 2013-03-04 12:37) - PLID 34339 - function to attach a new file void CLabResultsTabDlg::AttachNewFile(NXDATALIST2Lib::IRowSettingsPtr pRow, NXDATALIST2Lib::IRowSettingsPtr pParent) { // Code paraphrased from CHistoryDlg::OnClickAttach(). CString path; //DRT 10/28/2003 - PLID 9921 - Added a row for "Commonly Attached" which contains *.doc, *.xls, *.jpg, //*.bmp, *.pcx, *.tiff, *.wav. This is the default selected item, so that users can quickly add things //without changing the file type. // Also changed the description of the other items to include the types they show //PLID 18882 - added PDF's to the commonly selected files and their own type // (a.walling 2007-07-19 11:25) - PLID 26748 - Added office 2007 files (docx, xlsx) also jpeg // (a.walling 2007-09-17 16:11) - PLID 26748 - Also need PowerPoint 2007 files. // (a.walling 2007-10-12 14:50) - PLID 26342 - Moved to a shared string, and also include other formats //only allow 1 file to be selected // (a.walling 2012-04-27 15:23) - PLID 46648 - Dialogs must set a parent! CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT , szCommonlyAttached, this); long nMailID = VarLong(GetTreeValue(pRow, lrfValue, lrtcForeignKeyID), -1); long nResultID = VarLong(pRow->GetValue(lrtcResultID)); CString strInitPath; if (nMailID != -1) { strInitPath = VarString(GetTreeValue(pRow, lrfValue, lrtcValue), GetPatientDocumentPath(m_nPatientID)); } else { strInitPath = GetPatientDocumentPath(m_nPatientID); } if(!DoesExist(strInitPath)) { // This shouldn't be possible because either GetPatientDocumentPath should return a // valid path to a folder that exists, or it should throw an exception ASSERT(FALSE); AfxThrowNxException("Person document folder '%s' could not be found", path); return; } dlg.m_ofn.lpstrInitialDir = strInitPath; //TES 5/26/2004: We have to supply our own buffer, otherwise it will only allow 255 characters. char * strFile = new char[5000]; strFile[0] = 0; dlg.m_ofn.nMaxFile = 5000; dlg.m_ofn.lpstrFile = strFile; if (dlg.DoModal() == IDOK) { POSITION p = dlg.GetStartPosition(); if (p) { if (nMailID > 0) { //there is already a document attached, so we need to clear it m_aryDetachedDocs.Add(nResultID); //everything else will be replaced later } CString strPath = dlg.GetNextPathName(p); // (c.haag 2009-05-06 14:54) - PLID 33789 - Units SetTreeValue(pRow, lrfUnits, lrtcValue, _variant_t("")); SetDlgItemText(IDC_RESULT_UNITS, ""); SetTreeValue(pRow, lrfValue, lrtcForeignKeyID, (long)-2); SetTreeValue(pRow, lrfValue, lrtcValue, _variant_t(strPath)); // (c.haag 2011-01-27) - PLID 41618 - We always need a date. For now, use the current server // date so the attachments are still sorted chronologically SetTreeValue(pRow, lrfValue, lrtcDate, _variant_t(GetServerTime(), VT_DATE)); //we are storing the path in the datalist, but not link m_nxlDocPath.SetText(GetFileName(strPath)); m_nxlDocPath.SetType(dtsHyperlink); // (c.haag 2010-12-06 13:48) - PLID 41618 - Should only be showing if we're in the discrete values view if (!m_bControlsHidden) { ShowDlgItem(IDC_DOC_PATH_LINK, SW_SHOW); InvalidateDlgItem(IDC_DOC_PATH_LINK); } //TES 11/23/2009 - PLID 36192 - Remember that this file is attached to this result. //TES 1/27/2010 - PLID 36862 - Moved into its own function SetAttachedFile((LPDISPATCH)pParent, strPath); //TES 11/23/2009 - PLID 36192 - Go ahead and re-load the result, this will update the browser and other controls. SaveResult(pRow); LoadResult(pRow); } } // (a.walling 2008-10-17 11:24) - PLID 31724 - Clear the memory of the file buffer delete [] strFile; } // (j.dinatale 2013-03-04 12:37) - PLID 34339 - function to attach an existing file void CLabResultsTabDlg::AttachExistingFile(NXDATALIST2Lib::IRowSettingsPtr pRow, NXDATALIST2Lib::IRowSettingsPtr pParent) { long nMailID = VarLong(GetTreeValue(pRow, lrfValue, lrtcForeignKeyID), -1); long nResultID = VarLong(pRow->GetValue(lrtcResultID)); //1. set up the fields we are interested in having CStringArray aryColumns; aryColumns.Add("MailSent.MailID"); aryColumns.Add("MailSent.ServiceDate"); aryColumns.Add("MailSentNotesT.Note"); aryColumns.Add("CatsSubQ.Description"); aryColumns.Add("MailSent.PathName"); //2. Column Headers (order matters) CStringArray aryColumnHeaders; aryColumnHeaders.Add("Mail ID"); aryColumnHeaders.Add("Service Date"); aryColumnHeaders.Add("Description"); aryColumnHeaders.Add("Category"); aryColumnHeaders.Add("File Name"); //3. Sort order for columns (order matters) CSimpleArray<short> arySortOrder; arySortOrder.Add(-1); arySortOrder.Add(0); arySortOrder.Add(1); arySortOrder.Add(2); arySortOrder.Add(3); CString strWhere; strWhere.Format(" MailSent.PersonID = %li AND InternalRefID IS NULL AND MailSent.Selection <> '' AND MailSent.Selection <> 'BITMAP:FOLDER' ", m_nPatientID); // Open the single select dialog CSingleSelectMultiColumnDlg dlg(this); HRESULT hr = dlg.Open( " MailSent LEFT JOIN MailSentNotesT ON MailSent.MailID = MailSentNotesT.MailID " " LEFT JOIN ( " " SELECT ID, Description " " FROM NoteCatsF " " WHERE IsPatientTab = 1 " " ) CatsSubQ ON MailSent.CategoryID = CatsSubQ.ID ", /*From*/ strWhere, /*Where*/ aryColumns, /*Select*/ aryColumnHeaders, /*Column Names*/ arySortOrder, /*Sort Order*/ "[1] - [2]", /*Display Columns*/ "Please select an existing file to attach to this lab.", /*Description*/ "Select an Existing File" /*Title Bar Header*/ ); // If they clicked OK, be sure to check if they made a valid selection if(hr == IDOK){ CVariantArray varySelectedValues; dlg.GetSelectedValues(varySelectedValues); if(!varySelectedValues.GetSize()){ this->MessageBox("You did not select an existing file to attach. Please try again.", "No File Selected", MB_OK | MB_ICONEXCLAMATION); return; } long nNewMailID = VarLong(varySelectedValues.GetAt(0), -1); CString strFileName = VarString(varySelectedValues.GetAt(4), ""); // if we didnt get a valid mailID, somehow it was equal to the one we had, or if the file name is empty, bail if(nNewMailID <= 0 || nNewMailID == nMailID || strFileName.IsEmpty()){ return; } CString strPatDocPath = GetPatientDocumentPath(m_nPatientID); if(!FileUtils::EnsureDirectory(strPatDocPath)) { // This shouldn't be possible because either GetPatientDocumentPath should return a // valid path to a folder that exists, or it should throw an exception ASSERT(FALSE); AfxThrowNxException("Person document folder '%s' could not be found", strPatDocPath); return; } if (nMailID > 0) { m_aryDetachedDocs.Add(nResultID); } strFileName = strPatDocPath ^ strFileName; SetTreeValue(pRow, lrfUnits, lrtcValue, _variant_t("")); SetDlgItemText(IDC_RESULT_UNITS, ""); SetTreeValue(pRow, lrfValue, lrtcForeignKeyID, (long)nNewMailID); SetTreeValue(pRow, lrfValue, lrtcValue, _variant_t(GetFileName(strFileName))); SetTreeValue(pRow, lrfValue, lrtcDate, _variant_t(GetServerTime(), VT_DATE)); //we are storing the path in the datalist, but not link m_nxlDocPath.SetText(GetFileName(strFileName)); m_nxlDocPath.SetType(dtsHyperlink); if (!m_bControlsHidden){ ShowDlgItem(IDC_DOC_PATH_LINK, SW_SHOW); InvalidateDlgItem(IDC_DOC_PATH_LINK); } SetAttachedFile((LPDISPATCH)pParent, strFileName); SaveResult(pRow); LoadResult(pRow); } } // (j.luckoski 2013-03-20 11:39) - PLID 55424 - Mark all results ack, signed, complete in one step. void CLabResultsTabDlg::OnBnClickedLabMarkAllComplete() { try { // (b.cardillo 2013-08-07 12:21) - PLID 57903 - Can't allow signing or completing if you don't have the necessary permission if(!CheckCurrentUserPermissions(bioPatientLabs, sptDynamic3) || !CheckCurrentUserPermissions(bioPatientLabs, sptDynamic0)) { return; } // (f.gelderloos 2013-08-26 10:31) - PLID 57826 Ack, sign, and complete the labs when this button is pressed. IRowSettingsPtr pActiveRow = m_pResultsTree->CurSel; long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } AcknowledgeResults(m_pResultsTree->CurSel, true); if (AllResultsAreAcknowledged(nLabID)) SignResults(m_pResultsTree->CurSel, true); if (AllResultsAreSigned(nLabID)) MarkLabCompleted(m_pResultsTree->CurSel,true); } NxCatchAll(__FUNCTION__); } // (b.spivey, July 12, 2013) - PLID 45194 - borrowed code from another file that used twain, // and then I gutted it of near everything. void CLabResultsTabDlg::DoTWAINAcquisition(NXTWAINlib::EScanTargetFormat eScanTargetFormat) { //Code paraphrased from CHistoryDlg::OnAcquire() if (NXTWAINlib::IsAcquiring()) { MsgBox("Please wait for the current image acquisition to complete before starting a new one."); return; } //Get category ID using the default category long nCategoryID = (long)GetRemotePropertyInt("LabAttachmentsDefaultCategory",-1,0,"<None>",true); //PatID long nPatientID = GetPatientID(); //And Current row. NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; //Create struct and set pDialog and pRow. m_drsThis->pDialog = this; m_drsThis->pRow = pRow; //This will attach the document to the patient's history for us. NXTWAINlib::Acquire(nPatientID, GetPatientDocumentPath(nPatientID), OnTWAINCallback, OnNxTwainPreCompress, m_drsThis, "", nCategoryID, -1, -1, eScanTargetFormat); } // (b.spivey, July 15, 2013) - PLID 45194 - callback function when the scanner is done. void WINAPI CALLBACK CLabResultsTabDlg::OnTWAINCallback(NXTWAINlib::EScanType type, /* Are we scanning to the patient folder, or to another location? */ const CString& strFileName, /* The full filename of the document that was scanned */ BOOL& bAttach, void* pUserData, CxImage& cxImage) { try { //The user data is the struct with a pointer to the dialog and the current row. DialogRowStruct* drsThis = (DialogRowStruct*) pUserData; if (drsThis) { drsThis->pDialog->AttachFileToResult(strFileName, drsThis->pRow); // (b.spivey, July 18, 2013) - PLID 45194 - Once we're done, set this to null pUserData = NULL; } }NxCatchAll_NoParent(__FUNCTION__); // (a.walling 2014-05-05 13:32) - PLID 61945 } // (b.spivey, July 12, 2013) - PLID 45194 - This code was take from another function that attaches the file // to the result so that it is saved in memory or in data and when we reopen it will actually be there. // Left comments in because they're relevent. void CLabResultsTabDlg::AttachFileToResult(CString strFilePath, NXDATALIST2Lib::IRowSettingsPtr pRow) { // (c.haag 2009-05-06 14:54) - PLID 33789 - Units SetTreeValue(pRow, lrfUnits, lrtcValue, _variant_t("")); SetDlgItemText(IDC_RESULT_UNITS, ""); SetTreeValue(pRow, lrfValue, lrtcForeignKeyID, (long)-2); SetTreeValue(pRow, lrfValue, lrtcValue, _variant_t(strFilePath)); // (c.haag 2011-01-27) - PLID 41618 - We always need a date. For now, use the current server // date so the attachments are still sorted chronologically SetTreeValue(pRow, lrfValue, lrtcDate, _variant_t(GetServerTime(), VT_DATE)); //we are storing the path in the datalist, but not link m_nxlDocPath.SetText(GetFileName(strFilePath)); m_nxlDocPath.SetType(dtsHyperlink); // (c.haag 2010-12-06 13:48) - PLID 41618 - Should only be showing if we're in the discrete values view if (!m_bControlsHidden) { ShowDlgItem(IDC_DOC_PATH_LINK, SW_SHOW); InvalidateDlgItem(IDC_DOC_PATH_LINK); } //TES 11/23/2009 - PLID 36192 - Remember that this file is attached to this result. //TES 1/27/2010 - PLID 36862 - Moved into its own function SetAttachedFile((LPDISPATCH)GetResultRow(pRow), strFilePath); //TES 11/23/2009 - PLID 36192 - Go ahead and re-load the result, this will update the browser and other controls. SaveResult(pRow); LoadResult(pRow); } // (b.spivey, August 23, 2013) - PLID 46295 - Get the anatomical location we display on the patient's lab tab. CString CLabResultsTabDlg::GetAnatomicalLocationAsString(long nLabID) { CString strLocation = ""; strLocation = m_pLabEntryDlg->GetAnatomicLocationByLabID(nLabID); // (b.spivey, September 05, 2013) - PLID 46295 - Changed to "Anatomic Location" return (strLocation.IsEmpty() ? "" : "Anatomic Location: " + strLocation); } // (f.gelderloos 2013-08-26 10:31) - PLID 57826 void CLabResultsTabDlg::OnBnClickedLabAcknowledgeandsign() { try { if(!CheckCurrentUserPermissions(bioPatientLabs, sptDynamic3)) return; // (f.gelderloos 2013-08-26 10:31) - PLID 57826 Ack and Sign the labs when this button is pressed. IRowSettingsPtr pActiveRow = m_pResultsTree->CurSel; long nLabID = -1; { IRowSettingsPtr pActiveResultRow = GetResultRow(pActiveRow); IRowSettingsPtr pActiveLabRow = GetLabRow(pActiveRow); nLabID = (NULL == pActiveLabRow) ? -2 : VarLong(pActiveLabRow->GetValue(lrtcForeignKeyID),-1); } AcknowledgeResults(m_pResultsTree->CurSel, true); if (AllResultsAreAcknowledged(nLabID)) SignResults(m_pResultsTree->CurSel, true); } NxCatchAll(__FUNCTION__); } // (b.spivey, September 05, 2013) - PLID 46295 - ensure data when we show the window. void CLabResultsTabDlg::OnShowWindow(BOOL bShow, UINT nStatus) { try { // (b.spivey, August 28, 2013) - PLID 46295 - made it a general function but for now this is to ensure that the labels // show the most current anatomical location. if (bShow) { EnsureData(); } }NxCatchAll(__FUNCTION__); } // (j.jones 2013-10-18 11:32) - PLID 58979 - added infobutton void CLabResultsTabDlg::OnBtnPtEducation() { try { NXDATALIST2Lib::IRowSettingsPtr pRow = m_pResultsTree->CurSel; if(pRow == NULL || pRow->GetValue(lrtcResultID).vt == VT_NULL) { MessageBox("Patient Education cannot be loaded because no lab result has been selected.", "Practice", MB_ICONINFORMATION|MB_OK); return; } //force a save if(!SaveResult(pRow)) { return; } if(!m_pLabEntryDlg->Save()){ return; } long nLabResultID = VarLong(pRow->GetValue(lrtcResultID), -1); if(nLabResultID == -1) { //should not be possible, because we forced a save ASSERT(FALSE); ThrowNxException("No valid lab result ID was found."); } //the info button goes to the MedlinePlus website using the HL7 InfoButton URL standard LookupMedlinePlusInformationViaURL(this, mlpLabResultID, nLabResultID); }NxCatchAll(__FUNCTION__); } // (d.singleton 2013-10-29 12:08) - PLID 59197 - need to move the specimen segment values to its own header in the html view for labs, so it will show regardless of any results. CString CLabResultsTabDlg::GetSpecimenFieldsHTML(NXDATALIST2Lib::IRowSettingsPtr pSpecRow) { CString strHTML = ""; if(pSpecRow) { CString strFieldName, strDivName, strFieldValue; long nColumnCount = 2; long nColumnWidth = (nColumnCount==0)?0:GetBrowserWidth()/nColumnCount; // (d.singleton 2013-10-28 16:37) - PLID 59197 - need to move the specimen segment values to its own header in the html view for labs, so it will show regardless of any results. for(long i = (long)lrtcSpecimenIDText; i <= (long)lrtcSpecimenCondition; i++) { //reset the values of our field name div and value strFieldName = strDivName = strFieldValue = ""; switch((LabResultTreeColumns)i) { case lrtcSpecimenIDText: { // (d.singleton 2014-01-16 16:16) - PLID 60225 - need an option to hide spm data on the report view of a lab result. if(GetRemotePropertyInt("LabReportViewFieldShow", 1, lrfSpecimenIdText, "<None>")) { _variant_t varSpecIDText = pSpecRow->GetValue(lrtcSpecimenIDText); if(varSpecIDText.vt == VT_BSTR) { strFieldName = "Specimen ID Text"; strFieldValue = ConvertToQuotableXMLString(VarString(varSpecIDText)); strDivName = "SpecimenIDText"; } } } break; case lrtcSpecimenCollectionStartTime: { // (d.singleton 2014-01-16 16:16) - PLID 60225 - need an option to hide spm data on the report view of a lab result. if(GetRemotePropertyInt("LabReportViewFieldShow", 1, lrfSpecimenStartTime, "<None>")) { strFieldName = "Specimen Collection Start Time"; strDivName = "SecColStartTime"; _variant_t var = pSpecRow->GetValue(lrtcSpecimenCollectionStartTime); COleDateTime dtSpecStartTime; if(var.vt == VT_DATE) { dtSpecStartTime = VarDateTime(var); } else if(var.vt == VT_BSTR) { if(VarString(var).IsEmpty()) { dtSpecStartTime.SetStatus(COleDateTime::invalid); } else { dtSpecStartTime.ParseDateTime(VarString(var)); } } else { dtSpecStartTime.SetStatus(COleDateTime::invalid); } if(dtSpecStartTime.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtSpecStartTime); } } } break; case lrtcSpecimenCollectionEndTime: { // (d.singleton 2014-01-16 16:16) - PLID 60225 - need an option to hide spm data on the report view of a lab result. if(GetRemotePropertyInt("LabReportViewFieldShow", 1, lrfSpecimenEndTime, "<None>")) { strFieldName = "Specimen Collection End Time"; strDivName = "SecColEndTime"; _variant_t var = pSpecRow->GetValue(lrtcSpecimenCollectionEndTime); COleDateTime dtSpecEndTime; if(var.vt == VT_DATE) { dtSpecEndTime = VarDateTime(var); } else if(var.vt == VT_BSTR) { if(VarString(var).IsEmpty()) { dtSpecEndTime.SetStatus(COleDateTime::invalid); } else { dtSpecEndTime.ParseDateTime(VarString(var)); } } else { dtSpecEndTime.SetStatus(COleDateTime::invalid); } if(dtSpecEndTime.GetStatus() == COleDateTime::valid) { strFieldValue = FormatDateTimeForInterface(dtSpecEndTime); } } } break; case lrtcSpecimenRejectReason: { // (d.singleton 2014-01-16 16:16) - PLID 60225 - need an option to hide spm data on the report view of a lab result. if(GetRemotePropertyInt("LabReportViewFieldShow", 1, lrfSpecimenRejectReason, "<None>")) { _variant_t varSpecRejReason = pSpecRow->GetValue(lrtcSpecimenRejectReason); if(varSpecRejReason.vt == VT_BSTR) { strFieldName = "Specimen Reject Reason"; strFieldValue = ConvertToQuotableXMLString(VarString(varSpecRejReason)); strDivName = "SpecimenRejectReason"; } } } break; case lrtcSpecimenCondition: { // (d.singleton 2014-01-16 16:16) - PLID 60225 - need an option to hide spm data on the report view of a lab result. if(GetRemotePropertyInt("LabReportViewFieldShow", 1, lrfSpecimenCondition, "<None>")) { _variant_t varSpecCondition = pSpecRow->GetValue(lrtcSpecimenCondition); if(varSpecCondition.vt == VT_BSTR) { strFieldName = "Specimen Condition"; strFieldValue = ConvertToQuotableXMLString(VarString(varSpecCondition)); strDivName = "SpecimenCondition"; } } } break; default: //if this happens you need to add code for your new column here ASSERT(FALSE); break; } if(!strFieldValue.IsEmpty()) { strHTML += FormatString("\t\t\t\t<td colspan=\"1\">\r\n"); strHTML += FormatString("\t\t\t\t\t<div id=\"%s\" style=\"width:%ipx;text-align:left;vertical-align:top;\"> \r\n", strDivName, nColumnWidth); strHTML += FormatString("\t\t\t\t\t\t<span class=\"MinorTitle\"> %s: </span> \r\n", strFieldName); // (r.gonet 07/26/2013) - PLID 57751 - Noticed linebreaks weren't being retained in the report view for mapped fields. Fixed. strFieldValue.Replace("\r\n", "<BR/>"); // (r.gonet 03/07/2013) - PLID 43599 - If the setting is disabled, preserve consecutive whitespace. if(GetRemotePropertyInt("LabReportViewTrimExtraSpaces", TRUE) == FALSE) { strFieldValue.Replace(" ", "&nbsp;"); } else { // The browser will trim the spaces. } strHTML += FormatString("\t\t\t\t\t\t<span class=\"MinorInfo\"> %s </span> \r\n", strFieldValue); strHTML += "\t\t\t\t\t</div>\r\n"; strHTML += "\t\t\t\t</td>\r\n"; } else { FormatString("<td colspan=\"1\"><div style=\"width:%ipx;text-align:left;vertical-align:top;\"></div></td>", nColumnWidth); } } if(!strHTML.IsEmpty()) { strHTML += "\t\t\t<div class=\"InnerRow\">\r\n"; strHTML += "\t\t\t\t<div class=\"InnerCellWithBorder\">\r\n"; strHTML += "\t\t\t\t\t<div id=\"End\"> "; strHTML += "\t\t\t\t\t\t<span class=\"MinorTitle\"> </span> \r\n"; strHTML += "\t\t\t\t\t\t<span class=\"MinorInfo\"> </span> \r\n"; strHTML += "\t\t\t\t\t</div>\r\n"; //close the Cell strHTML += "\t\t\t\t</div>\r\n"; //close the Row strHTML += "\t\t\t</div>\r\n"; } } return strHTML; } // (r.goldschmidt 2016-02-18 17:52) - PLID 68267 - Filter the microscopic description list for any linked descriptions that are linked with the final lab diagnoses that the user chose // (only use when it is known that there is a link for the microscopic description) void CLabResultsTabDlg::FilterClinicalDiagnosisOptionsList(const std::set<long>& arIDs) { try { IRowSettingsPtr pRow = m_pClinicalDiagOptionsList->GetFirstRow(); while (pRow) { if (VarLong(pRow->GetValue(cdolcHasLink)) == (long)fvSpecialShowAll) { // show the special <show all> option pRow->PutVisible(VARIANT_TRUE); } else if (arIDs.count(VarLong(pRow->GetValue(cdolcID))) > 0) { // there is a link, filter it in pRow->PutValue(cdolcHasLink, _variant_t(fvHasLink)); pRow->PutVisible(VARIANT_TRUE); } else { // there is no link, filter it out pRow->PutValue(cdolcHasLink, _variant_t(fvNoLink)); pRow->PutVisible(VARIANT_FALSE); } pRow = pRow->GetNextRow(); } }NxCatchAll(__FUNCTION__); } // (r.goldschmidt 2016-02-18 18:03) - PLID 68267 - Unfilter the list void CLabResultsTabDlg::RemoveFilterClinicalDiagnosisOptionsList() { try { IRowSettingsPtr pRow = m_pClinicalDiagOptionsList->GetFirstRow(); while (pRow) { if (VarLong(pRow->GetValue(cdolcHasLink)) == (long)fvSpecialShowAll) { // show the special <show all> option pRow->PutVisible(VARIANT_FALSE); } else if (VarLong(pRow->GetValue(cdolcHasLink)) == (long)fvHasLink) { // there was a filtered link, reset pRow->PutValue(cdolcHasLink, _variant_t(fvNoLink)); pRow->PutVisible(VARIANT_TRUE); } else { // there was no filtered link, show again pRow->PutVisible(VARIANT_TRUE); } pRow = pRow->GetNextRow(); } }NxCatchAll(__FUNCTION__); } // (r.goldschmidt 2016-02-18 18:03) - PLID 68268 - add <show all> row when requerying into a filtered list void CLabResultsTabDlg::RequeryFinishedClinicalDiagnosisOptionsList(short nFlags) { try { // add <show all> IRowSettingsPtr pRow = m_pClinicalDiagOptionsList->GetNewRow(); pRow->PutValue(cdolcID, (long)-1); pRow->PutValue(cdolcDesc, _bstr_t("")); pRow->PutValue(cdolcDescForSorting, _bstr_t("<show all>")); pRow->PutValue(cdolcHasLink, (long)fvSpecialShowAll); pRow->PutVisible(VARIANT_FALSE); m_pClinicalDiagOptionsList->AddRowBefore(pRow, m_pClinicalDiagOptionsList->GetFirstRow()); }NxCatchAll(__FUNCTION__); } // (r.goldschmidt 2016-02-19 10:37) - PLID 68266 - add diagnosis to clinical diagnosis linking void CLabResultsTabDlg::AddLabClinicalDiagnosisLink(const std::set<long>& arDiagnosisIDs, long nClinicalDiagnosisID) { try { Nx::SafeArray<long> saDiagIDs(arDiagnosisIDs.size(), begin(arDiagnosisIDs), end(arDiagnosisIDs)); std::set<long> arClinicalDiagIDs; arClinicalDiagIDs.insert(nClinicalDiagnosisID); Nx::SafeArray<long> saClinicalDiagIDs(arClinicalDiagIDs.size(), begin(arClinicalDiagIDs), end(arClinicalDiagIDs)); GetAPI()->CreateLabClinicalDiagnosisLinking(GetAPISubkey(), GetAPILoginToken(), saDiagIDs, saClinicalDiagIDs, VARIANT_FALSE); }NxCatchAll(__FUNCTION__); }
[ "h.shah@WALD" ]
h.shah@WALD
9973ba527dcd5e56e303de83a8f3534a82b57b4d
cfbadd013412641c6221008941d68dd73f2bdddd
/TLE/tle17c5p1.cpp
2dd9620bb3e6291f1dfff1e624e5284ffdae63ae
[]
no_license
YinuoWang/competitive_programming
48c3dd2b17f9cb47648360953438912829992b0b
4012ce7e9222c7a38b43217bed9d557e7d47bf08
refs/heads/master
2023-03-25T02:50:35.129843
2021-03-21T06:23:09
2021-03-21T06:25:11
113,873,684
0
0
null
null
null
null
UTF-8
C++
false
false
160
cpp
#include <iostream> using namespace std; int main(){ cout << "guess 50\n"; int n; cin >> n; cout << "answer " << 50-n << '\n'; return 0; }
[ "yinuo_wang@yahoo.ca" ]
yinuo_wang@yahoo.ca
e01d3f05f4df9e4752d46d37ec7c30a8b6b5322a
55725abd9d7877f719747bc64d0a4401447f5e87
/ESO50CM/Observing/src/ObsControl.cpp
a80ed0bc34461005c0938ba77c4a04e38d98a08a
[]
no_license
tzuchiangshen/eso50cm
3947b9c78657a768c634a9f4b77a6f8c01177f34
801223d254fb08ad2b246646b73b9ded604cf7c6
refs/heads/master
2020-04-26T09:43:29.073952
2013-03-26T02:02:54
2013-03-26T02:02:54
32,118,017
0
0
null
null
null
null
UTF-8
C++
false
false
1,398
cpp
#include <ObservingImpl.h> #include <Ice/Ice.h> using namespace std; //global variable: to be fix int verbose = 1; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ObsAdapter"); Ice::ObjectPtr object = new ObservingImpl(adapter); adapter->add(object, communicator->stringToIdentity("Observing")); adapter->activate(); communicator->waitForShutdown(); return EXIT_SUCCESS; } int main(int argc, char* argv[]) { int status; Ice::CommunicatorPtr communicator; try { string configPath = getenv("SWROOT"); configPath = configPath + "/config/Obs-config"; Ice::InitializationData initData; initData.properties = Ice::createProperties(); initData.properties->load(configPath); initData.properties->setProperty("Ice.Override.Timeout", "3000"); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) { cerr << ex << endl; status = EXIT_FAILURE; } if(communicator) { try { communicator->destroy(); } catch(const Ice::Exception& ex) { cerr << ex << endl;; status = EXIT_FAILURE; } } return status; }
[ "tzuchiangshen@gmail.com@252240e4-1210-6a41-b381-b427a22c1ab4" ]
tzuchiangshen@gmail.com@252240e4-1210-6a41-b381-b427a22c1ab4
134e4caaaf66c0e4f002a8354dec97908aed6564
c3ffa07567d3d29a7439e33a6885a5544e896644
/CodeForce/500-B.cpp
b2566d89e63fec7f3868af31b8aac1ffc75187bb
[]
no_license
a00012025/Online_Judge_Code
398c90c046f402218bd14867a06ae301c0c67687
7084865a7050fc09ffb0e734f77996172a93d3ce
refs/heads/master
2018-01-08T11:33:26.352408
2015-10-10T23:20:35
2015-10-10T23:20:35
44,031,127
0
0
null
null
null
null
UTF-8
C++
false
false
796
cpp
#include<bits/stdc++.h> using namespace std; const int maxn=400 ; int a[maxn],inv[maxn],ans[maxn] ; char G[maxn][maxn] ; bool d[maxn][maxn] ; main() { int n ; scanf("%d",&n) ; for(int i=1;i<=n;i++) scanf("%d",&a[i]) , inv[a[i]]=i ; for(int i=1;i<=n;i++) scanf("%s",&G[i][1]) ; memset(d,0,sizeof(d)) ; for(int i=1;i<=n;i++) d[i][i]=1 ; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(G[i][j]=='1') d[i][j]=1 ; for(int k=1;k<=n;k++) for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(d[k][j]==1) d[i][j]|=d[i][k] ; memset(ans,0,sizeof(ans)) ; for(int i=1;i<=n;i++) { int j ; for(j=1;ans[j]||!d[inv[i]][j];j++) ; ans[j]=i ; } for(int i=1;i<=n;i++) printf("%d%c",ans[i],i==n?'\n':' ') ; }
[ "a00012025@gmail.com" ]
a00012025@gmail.com
e1b4a94651bec1485450e427d0f6bf56710445b7
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/curl/gumtree/curl_patch_hunk_884.cpp
99b884ce59574dcfec0d8c3c6b3b245b533e6c1f
[]
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
2,041
cpp
} #endif return bytes_written; } +/* + * add_buffer_init() returns a fine buffer struct + */ +send_buffer *add_buffer_init(void) +{ + send_buffer *blonk; + blonk=(send_buffer *)malloc(sizeof(send_buffer)); + if(blonk) { + memset(blonk, 0, sizeof(send_buffer)); + return blonk; + } + return NULL; /* failed, go home */ +} +/* + * add_buffer_send() sends a buffer and frees all associated memory. + */ +size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in) +{ + size_t amount; + if(conn->data->bits.verbose) { + fputs("> ", conn->data->err); + /* this data _may_ contain binary stuff */ + fwrite(in->buffer, in->size_used, 1, conn->data->err); + } + + amount = ssend(sockfd, conn, in->buffer, in->size_used); + if(in->buffer) + free(in->buffer); + free(in); + + return amount; +} + + +/* + * add_bufferf() builds a buffer from the formatted input + */ +CURLcode add_bufferf(send_buffer *in, char *fmt, ...) +{ + CURLcode result = CURLE_OUT_OF_MEMORY; + char *s; + va_list ap; + va_start(ap, fmt); + s = mvaprintf(fmt, ap); /* this allocs a new string to append */ + va_end(ap); + + if(s) { + result = add_buffer(in, s, strlen(s)); + free(s); + } + return result; +} + +/* + * add_buffer() appends a memory chunk to the existing one + */ +CURLcode add_buffer(send_buffer *in, void *inptr, size_t size) +{ + char *new_rb; + int new_size; + + if(size > 0) { + if(!in->buffer || + ((in->size_used + size) > (in->size_max - 1))) { + new_size = (in->size_used+size)*2; + if(in->buffer) + /* we have a buffer, enlarge the existing one */ + new_rb = (char *)realloc(in->buffer, new_size); + else + /* create a new buffer */ + new_rb = (char *)malloc(new_size); + + if(!new_rb) + return CURLE_OUT_OF_MEMORY; + + in->buffer = new_rb; + in->size_max = new_size; + } + memcpy(&in->buffer[in->size_used], inptr, size); + + in->size_used += size; + } + + return CURLE_OK; +}
[ "993273596@qq.com" ]
993273596@qq.com
c53dea291dfb0bd503259fe0e8506c4b62c21a68
3df6badbe1e4ab7f5f5400e79732868d9c5c9274
/code/lt0187.cpp
60e51be487be9e8463c9f0ae1a73c8cbbe880bb3
[]
no_license
iwtbam/leetcode
fa440bf889b69bf3a6a3de1bf1846db3ca6aace9
d76b120068919971775595ae306683aa0bab2bde
refs/heads/master
2021-07-01T10:20:03.507257
2021-02-14T14:20:51
2021-02-14T14:20:51
214,327,800
11
6
null
null
null
null
UTF-8
C++
false
false
538
cpp
#include <set> #include <vector> #include <string> using namespace std; class Solution { public: vector<string> findRepeatedDnaSequences(string s) { set<string> s1; set<string> s2; int size = s.size(); for(int i = 0; i < size - 10; i++){ auto str = s.substr(0, 10); if(s1.find(str) == s1.end()){ s1.insert(str); } else{ s2.insert(str); } } return {s2.begin(), s2.end()}; } };
[ "1161784945@qq.com" ]
1161784945@qq.com
cdc3624c57a42efea9fd7057f1e4d6ef0a4bc0f4
901373e903f1b44e4d6880a1926328821e0877dc
/src/qt/rpcconsole.cpp
fb858a6ca0cfdd0bb3ecd2a81f81250ecff38c6f
[ "MIT" ]
permissive
bitpound/bitpound
f16da4d8e80b816840239009b6ef1333086c87ae
355d3022d6580867c9e4194037f8ebb1ff0ddc44
refs/heads/master
2021-01-10T14:13:58.149811
2016-01-17T16:56:29
2016-01-17T16:56:29
48,623,153
0
0
null
null
null
null
UTF-8
C++
false
false
14,507
cpp
#include "rpcconsole.h" #include "ui_rpcconsole.h" #include "clientmodel.h" #include "bitcoinrpc.h" #include "guiutil.h" #include <QTime> #include <QTimer> #include <QThread> #include <QTextEdit> #include <QKeyEvent> #include <QUrl> #include <QScrollBar> #include <openssl/crypto.h> // TODO: make it possible to filter out categories (esp debug messages when implemented) // TODO: receive errors and debug messages through ClientModel const int CONSOLE_SCROLLBACK = 50; const int CONSOLE_HISTORY = 50; const QSize ICON_SIZE(24, 24); const struct { const char *url; const char *source; } ICON_MAPPING[] = { {"cmd-request", ":/icons/tx_input"}, {"cmd-reply", ":/icons/tx_output"}, {"cmd-error", ":/icons/tx_output"}, {"misc", ":/icons/tx_inout"}, {NULL, NULL} }; /* Object for executing console RPC commands in a separate thread. */ class RPCExecutor: public QObject { Q_OBJECT public slots: void start(); void request(const QString &command); signals: void reply(int category, const QString &command); }; #include "rpcconsole.moc" void RPCExecutor::start() { // Nothing to do } /** * Split shell command line into a list of arguments. Aims to emulate \c bash and friends. * * - Arguments are delimited with whitespace * - Extra whitespace at the beginning and end and between arguments will be ignored * - Text can be "double" or 'single' quoted * - The backslash \c \ is used as escape character * - Outside quotes, any character can be escaped * - Within double quotes, only escape \c " and backslashes before a \c " or another backslash * - Within single quotes, no escaping is possible and no special interpretation takes place * * @param[out] args Parsed arguments will be appended to this list * @param[in] strCommand Command line to split */ bool parseCommandLine(std::vector<std::string> &args, const std::string &strCommand) { enum CmdParseState { STATE_EATING_SPACES, STATE_ARGUMENT, STATE_SINGLEQUOTED, STATE_DOUBLEQUOTED, STATE_ESCAPE_OUTER, STATE_ESCAPE_DOUBLEQUOTED } state = STATE_EATING_SPACES; std::string curarg; foreach(char ch, strCommand) { switch(state) { case STATE_ARGUMENT: // In or after argument case STATE_EATING_SPACES: // Handle runs of whitespace switch(ch) { case '"': state = STATE_DOUBLEQUOTED; break; case '\'': state = STATE_SINGLEQUOTED; break; case '\\': state = STATE_ESCAPE_OUTER; break; case ' ': case '\n': case '\t': if(state == STATE_ARGUMENT) // Space ends argument { args.push_back(curarg); curarg.clear(); } state = STATE_EATING_SPACES; break; default: curarg += ch; state = STATE_ARGUMENT; } break; case STATE_SINGLEQUOTED: // Single-quoted string switch(ch) { case '\'': state = STATE_ARGUMENT; break; default: curarg += ch; } break; case STATE_DOUBLEQUOTED: // Double-quoted string switch(ch) { case '"': state = STATE_ARGUMENT; break; case '\\': state = STATE_ESCAPE_DOUBLEQUOTED; break; default: curarg += ch; } break; case STATE_ESCAPE_OUTER: // '\' outside quotes curarg += ch; state = STATE_ARGUMENT; break; case STATE_ESCAPE_DOUBLEQUOTED: // '\' in double-quoted text if(ch != '"' && ch != '\\') curarg += '\\'; // keep '\' for everything but the quote and '\' itself curarg += ch; state = STATE_DOUBLEQUOTED; break; } } switch(state) // final state { case STATE_EATING_SPACES: return true; case STATE_ARGUMENT: args.push_back(curarg); return true; default: // ERROR to end in one of the other states return false; } } void RPCExecutor::request(const QString &command) { std::vector<std::string> args; if(!parseCommandLine(args, command.toStdString())) { emit reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \"")); return; } if(args.empty()) return; // Nothing to do try { std::string strPrint; // Convert argument list to JSON objects in method-dependent way, // and pass it along with the method name to the dispatcher. json_spirit::Value result = tableRPC.execute( args[0], RPCConvertValues(args[0], std::vector<std::string>(args.begin() + 1, args.end()))); // Format result reply if (result.type() == json_spirit::null_type) strPrint = ""; else if (result.type() == json_spirit::str_type) strPrint = result.get_str(); else strPrint = write_string(result, true); emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint)); } catch (json_spirit::Object& objError) { try // Nice formatting for standard-format error { int code = find_value(objError, "code").get_int(); std::string message = find_value(objError, "message").get_str(); emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")"); } catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message { // Show raw JSON object emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false))); } } catch (std::exception& e) { emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what())); } } RPCConsole::RPCConsole(QWidget *parent) : QDialog(parent), ui(new Ui::RPCConsole), historyPtr(0) { ui->setupUi(this); #ifndef Q_OS_MAC ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); ui->showCLOptionsButton->setIcon(QIcon(":/icons/options")); #endif // Install event filter for up and down arrow ui->lineEdit->installEventFilter(this); ui->messagesWidget->installEventFilter(this); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); // set OpenSSL version label ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION)); startExecutor(); clear(); } RPCConsole::~RPCConsole() { emit stopExecutor(); delete ui; } bool RPCConsole::eventFilter(QObject* obj, QEvent *event) { if(event->type() == QEvent::KeyPress) // Special key handling { QKeyEvent *keyevt = static_cast<QKeyEvent*>(event); int key = keyevt->key(); Qt::KeyboardModifiers mod = keyevt->modifiers(); switch(key) { case Qt::Key_Up: if(obj == ui->lineEdit) { browseHistory(-1); return true; } break; case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break; case Qt::Key_PageUp: /* pass paging keys to messages widget */ case Qt::Key_PageDown: if(obj == ui->lineEdit) { QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt)); return true; } break; default: // Typing in messages widget brings focus to line edit, and redirects key there // Exclude most combinations and keys that emit no text, except paste shortcuts if(obj == ui->messagesWidget && ( (!mod && !keyevt->text().isEmpty() && key != Qt::Key_Tab) || ((mod & Qt::ControlModifier) && key == Qt::Key_V) || ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert))) { ui->lineEdit->setFocus(); QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); return true; } } } return QDialog::eventFilter(obj, event); } void RPCConsole::setClientModel(ClientModel *model) { this->clientModel = model; if(model) { // Subscribe to information, replies, messages, errors connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); // Provide initial values ui->clientVersion->setText(model->formatFullVersion()); ui->clientName->setText(model->clientName()); ui->buildDate->setText(model->formatBuildDate()); ui->startupTime->setText(model->formatClientStartupTime()); setNumConnections(model->getNumConnections()); ui->isTestNet->setChecked(model->isTestNet()); setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers()); } } static QString categoryClass(int category) { switch(category) { case RPCConsole::CMD_REQUEST: return "cmd-request"; break; case RPCConsole::CMD_REPLY: return "cmd-reply"; break; case RPCConsole::CMD_ERROR: return "cmd-error"; break; default: return "misc"; } } void RPCConsole::clear() { ui->messagesWidget->clear(); ui->lineEdit->clear(); ui->lineEdit->setFocus(); // Add smoothly scaled icon images. // (when using width/height on an img, Qt uses nearest instead of linear interpolation) for(int i=0; ICON_MAPPING[i].url; ++i) { ui->messagesWidget->document()->addResource( QTextDocument::ImageResource, QUrl(ICON_MAPPING[i].url), QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } // Set default style sheet ui->messagesWidget->document()->setDefaultStyleSheet( "table { }" "td.time { color: #808080; padding-top: 3px; } " "td.message { font-family: Monospace; font-size: 12px; } " "td.cmd-request { color: #006060; } " "td.cmd-error { color: red; } " "b { color: #006060; } " ); message(CMD_REPLY, (tr("Welcome to the Bitpound RPC console.") + "<br>" + tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" + tr("Type <b>help</b> for an overview of available commands.")), true); } void RPCConsole::message(int category, const QString &message, bool html) { QTime time = QTime::currentTime(); QString timeString = time.toString(); QString out; out += "<table><tr><td class=\"time\" width=\"65\">" + timeString + "</td>"; out += "<td class=\"icon\" width=\"32\"><img src=\"" + categoryClass(category) + "\"></td>"; out += "<td class=\"message " + categoryClass(category) + "\" valign=\"middle\">"; if(html) out += message; else out += GUIUtil::HtmlEscape(message, true); out += "</td></tr></table>"; ui->messagesWidget->append(out); } void RPCConsole::setNumConnections(int count) { ui->numberOfConnections->setText(QString::number(count)); } void RPCConsole::setNumBlocks(int count, int countOfPeers) { ui->numberOfBlocks->setText(QString::number(count)); ui->totalBlocks->setText(QString::number(countOfPeers)); if(clientModel) { // If there is no current number available display N/A instead of 0, which can't ever be true ui->totalBlocks->setText(clientModel->getNumBlocksOfPeers() == 0 ? tr("N/A") : QString::number(clientModel->getNumBlocksOfPeers())); ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString()); } } void RPCConsole::on_lineEdit_returnPressed() { QString cmd = ui->lineEdit->text(); ui->lineEdit->clear(); if(!cmd.isEmpty()) { message(CMD_REQUEST, cmd); emit cmdRequest(cmd); // Truncate history from current position history.erase(history.begin() + historyPtr, history.end()); // Append command to history history.append(cmd); // Enforce maximum history size while(history.size() > CONSOLE_HISTORY) history.removeFirst(); // Set pointer to end of history historyPtr = history.size(); // Scroll console view to end scrollToEnd(); } } void RPCConsole::browseHistory(int offset) { historyPtr += offset; if(historyPtr < 0) historyPtr = 0; if(historyPtr > history.size()) historyPtr = history.size(); QString cmd; if(historyPtr < history.size()) cmd = history.at(historyPtr); ui->lineEdit->setText(cmd); } void RPCConsole::startExecutor() { QThread* thread = new QThread; RPCExecutor *executor = new RPCExecutor(); executor->moveToThread(thread); // Notify executor when thread started (in executor thread) connect(thread, SIGNAL(started()), executor, SLOT(start())); // Replies from executor object must go to this object connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString))); // Requests from this object must go to executor connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString))); // On stopExecutor signal // - queue executor for deletion (in execution thread) // - quit the Qt event loop in the execution thread connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater())); connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit())); // Queue the thread for deletion (in this thread) when it is finished connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. thread->start(); } void RPCConsole::on_tabWidget_currentChanged(int index) { if(ui->tabWidget->widget(index) == ui->tab_console) { ui->lineEdit->setFocus(); } } void RPCConsole::on_openDebugLogfileButton_clicked() { GUIUtil::openDebugLogfile(); } void RPCConsole::scrollToEnd() { QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar(); scrollbar->setValue(scrollbar->maximum()); } void RPCConsole::on_showCLOptionsButton_clicked() { GUIUtil::HelpMessageBox help; help.exec(); }
[ "caesar@Iuliuss-MacBook-Air.local" ]
caesar@Iuliuss-MacBook-Air.local
bf1ef334f2d35b84c33c6630552483fc74bde788
51e7b8214a1103daf485ea72100d68988efef29b
/1-3.cpp
6c44ad3882dea620c78a9a99aaf7d4ed0c6e40bb
[]
no_license
justin-tt/accelerated_cpp
eb25b2ed03e34ecf1505b5be87caeaecc89eb8b2
5b6f6fca0509f505dd8375aa0e00504b9bab0a81
refs/heads/master
2020-03-18T12:54:21.331063
2018-05-26T11:03:52
2018-05-26T11:03:52
134,750,243
0
0
null
null
null
null
UTF-8
C++
false
false
216
cpp
#include <iostream> #include <string> int main(){ { const std::string s = "a string"; std::cout << s << std::endl; } { const std::string s = "another string"; std::cout << s << std::endl; } return 0; }
[ "justin.ch.goh@gmail.com" ]
justin.ch.goh@gmail.com
2a832a23e4257930d0211c8b2654494a6dc00b3f
f0bd42c8ae869dee511f6d41b1bc255cb32887d5
/Codeforces/538A. Cutting Banner.cpp
4e04ba5a5a15a2843170ffdb79af9925dea429e4
[]
no_license
osamahatem/CompetitiveProgramming
3c68218a181d4637c09f31a7097c62f20977ffcd
a5b54ae8cab47b2720a64c68832a9c07668c5ffb
refs/heads/master
2021-06-10T10:21:13.879053
2020-07-07T14:59:44
2020-07-07T14:59:44
113,673,720
3
1
null
null
null
null
UTF-8
C++
false
false
555
cpp
/* * 538A. Cutting Banner.cpp * * Created on: Apr 26, 2015 * Author: Osama Hatem */ #include <bits/stdtr1c++.h> #include <ext/numeric> using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); // freopen("out.out", "w", stdout); #endif string in, tar = "CODEFORCES"; cin >> in; int len = (int) in.size(); for (int i = 0; i <= len; i++) for (int j = i; j <= len; j++) if (in.substr(0, i) + in.substr(j, len - j) == tar) { cout << "YES" << endl; return 0; } cout << "NO" << endl; return 0; }
[ "osama@elysian.team" ]
osama@elysian.team
d8c9f84372607957b4a5468cffd5fcfab7ab2b94
fb1f2c730ce459b6bec8b8401355e9cadc4b984e
/April/Day19-SearchInRotatedArray.cpp
c3e28271277a04ed9358a6509ce92c8d587cee66
[]
no_license
prtsh/30-Day-LeetcodeChallenge-2020
d12937ac358947ceaa16d77d1931d24f2e8a48f8
d2bc46436b23ba857e87fa2660c170c9260af58f
refs/heads/master
2022-06-08T11:50:11.754060
2020-05-08T02:41:08
2020-05-08T02:41:08
256,850,769
0
0
null
null
null
null
UTF-8
C++
false
false
1,333
cpp
/* Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no duplicate exists in the array. Your algorithm's runtime complexity must be in the order of O(log n). Example 1: Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4 Example 2: Input: nums = [4,5,6,7,0,1,2], target = 3 Output: -1 */ class Solution { public: int search(vector<int>& nums, int target) { int n = nums.size(); int start =0, end = n-1; while(start <= end){ int mid = start + (end-start)/2; cout<<mid<<" "; if(nums[mid] == target) return mid; //if both target and mid are on same side if((nums[mid] - nums[n-1])*(target - nums[n-1]) > 0){ if(target > nums[mid]) start = mid+1; else end = mid-1;// -1; } else if(target > nums[n-1]){ //target on the left side end = mid-1;//-1; }else{ //target on the right side, mid on the left side start = mid+1; } } return -1; } };
[ "pratyush.ismu@gmail.com" ]
pratyush.ismu@gmail.com
9f7d48793b7422b2e50f7fc79ec144c93b01601c
59df055dd9b5902eb27b73df840979cd7790f79d
/src/network-api/client-network-api.hxx
ab958febdbef3f2f901ceed977c65f28a7ac1391
[]
no_license
danielbaud/ChessEngine
e73bf0c83367bb0019b5460d1ea9d04d54ef18fe
7c37439847eca746ff558e0a8743ebad5c3c96a7
refs/heads/master
2020-06-19T15:35:42.653526
2019-07-13T21:35:05
2019-07-13T21:35:05
196,766,739
0
0
null
null
null
null
UTF-8
C++
false
false
2,119
hxx
#pragma once #include "client-network-api.hh" #include <array> #include <boost/asio.hpp> #include "common.hh" /** ** \brief Implementation file for the client API ** Do not modify! ** You do not have to read or understand it. */ namespace network_api { /* Namespace aliases */ namespace asio = boost::asio; using boost::asio::ip::tcp; /* Implementation */ class ClientNetworkAPI::Implementation { public: Implementation(const std::string& ip, const std::string& port) : socket_{io_service_} { tcp::resolver resolver{io_service_}; tcp::resolver::query query{ip, port}; auto point = resolver.resolve(query); boost::asio::connect(socket_, point); } tcp::socket& socket_get() { return socket_; } boost::asio::streambuf& buf_get() { return buf_; } private: asio::io_service io_service_; tcp::socket socket_; boost::asio::streambuf buf_; }; /* *** */ /* * Client API implementation */ inline ClientNetworkAPI::ClientNetworkAPI(const std::string& ip, const std::string& port) : pimpl_(std::make_unique<Implementation>(ip, port)) { } inline bool ClientNetworkAPI::acknowledge(const std::string& login) const { std::array<char, kack_size> data; auto buffer = boost::asio::buffer(data); pimpl_->socket_get().read_some(buffer); const std::string side_str{data.begin(), data.begin() + kack_size}; asio::write(pimpl_->socket_get(), asio::buffer(login)); return side_str == "BLACK"; } inline std::string ClientNetworkAPI::receive() { asio::read_until(pimpl_->socket_get(), pimpl_->buf_get(), "\n"); std::istream str(&pimpl_->buf_get()); std::string line; if (!str || !std::getline(str, line)) { throw std::runtime_error("IO error"); } return line; } inline void ClientNetworkAPI::send(const std::string& line) { asio::write(pimpl_->socket_get(), asio::buffer(line)); asio::write(pimpl_->socket_get(), asio::buffer(std::string("\n"))); } /* *** */ }
[ "daniel.baud@epita.fr" ]
daniel.baud@epita.fr
0a77036731b0642f9830aedefdb5696b58713972
a9de1209ef3c4dc58f24004fad3f66dc08f8a98a
/Huffman Coding and Entropy Calculator/BinaryTree.h
5d67d5def3c43cf5c7034a18fe624b69661e16fe
[]
no_license
tyrus-tracey/Huffman-Coding-and-Entropy-Calculator
1bc44efde2d69c3e5615a14a272fa7a9eb8f3fbb
24043f1c3d73b3826933f152eadf3e5abe75c320
refs/heads/master
2022-11-24T19:57:08.046022
2020-08-03T17:56:33
2020-08-03T17:56:33
278,427,444
0
0
null
null
null
null
UTF-8
C++
false
false
502
h
#pragma once #include "Node.h" #include <vector> class BinaryTree { public: BinaryTree(std::vector<Node> distribution); ~BinaryTree(); int size() const; bool empty() const; Node* root(); Node* position; void printTree(); void deleteTree(Node* node); void generateCodes(); double averageCodeLength(); int totalSize(); private: int symbolSize(Node* node); void generateCode(Node* node); double getCodeLength(Node* node); void printNode(Node* node); int treeSize; Node* rootNode; };
[ "ttracey@sfu.ca" ]
ttracey@sfu.ca
4e21c2d7a9a757a3e7504570fc065653484eac4d
19e748c74026e95d8946033715746f34066b2cf8
/.upstream-tests/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+_eq.pass.cpp
c04ef730c6eb1a9602eeb473f9b35157b539d3b7
[ "NCSA", "LLVM-exception", "MIT", "Apache-2.0" ]
permissive
JanuszL/libcudacxx
a0c156e7c2bf12e2ee97401a7dc3e33a928a7fb5
41c94bdb8ff4974f2317b505360690715b8f5f7a
refs/heads/main
2023-08-26T07:31:32.396998
2021-08-20T22:20:58
2021-08-20T22:20:58
408,430,785
0
0
NOASSERTION
2021-09-20T12:17:33
2021-09-20T12:17:32
null
UTF-8
C++
false
false
1,131
cpp
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // <cuda/std/chrono> // duration // constexpr duration& operator+=(const duration& d); // constexpr in C++17 #include <cuda/std/chrono> #include <cuda/std/cassert> #include "test_macros.h" #if TEST_STD_VER > 14 __host__ __device__ constexpr bool test_constexpr() { cuda::std::chrono::seconds s(3); s += cuda::std::chrono::seconds(2); if (s.count() != 5) return false; s += cuda::std::chrono::minutes(2); return s.count() == 125; } #endif int main(int, char**) { { cuda::std::chrono::seconds s(3); s += cuda::std::chrono::seconds(2); assert(s.count() == 5); s += cuda::std::chrono::minutes(2); assert(s.count() == 125); } #if TEST_STD_VER > 14 static_assert(test_constexpr(), ""); #endif return 0; }
[ "griwes@griwes.info" ]
griwes@griwes.info
39390995363e328cb610298c0ad038b74e884ce8
136f4d7ef71ea86b84220874edbea6d204931ff2
/src/rsba/Sfm2Ply.h
06175a9918594869d1ef325a4814efb2a9c9f4f6
[ "Apache-2.0" ]
permissive
brunobg/rsba
7c449119f580fa73444c4a4aac90ff13a15cd35a
4d4aa952c3a5e41bd8355d394f6ed15bc14802f3
refs/heads/master
2021-01-17T14:59:33.531808
2018-02-15T13:14:42
2018-02-15T13:14:42
83,324,871
0
0
null
2018-01-16T14:40:54
2017-02-27T15:22:07
C++
UTF-8
C++
false
false
428
h
#ifndef _Sfm2Ply_h #define _Sfm2Ply_h #include "rsba/struct/VideoSfM.h" #include "rsba/SfmOptions.h" using namespace std; namespace vision { namespace sfm { void writeCam(const double pose[6], unsigned cam_index, unsigned num_cameras, FILE* f); void writePly(const string& file, const sfm::Session& sess, const SfmOptions& opt, bool write_cameras = true, bool write_points = true); }} //namespace vision::sfm #endif
[ "henrique@apache.org" ]
henrique@apache.org
50488110b4e541666ce8a8180fa570a1b74f8574
48639c0acd4f70050e712873fd0b7f333d327434
/hackerrank/Data Structures/insert-a-node-at-the-head-of-a-linked-list.cpp
57a3abbbf80542bdc0034f43e5ad77fac90e53f1
[]
no_license
gjmingsg/Code
5cfddf4ce327262278b0940c78996e6f545484bb
66f9691585cda77c9685d09a80ab2ac57bd853f9
refs/heads/master
2021-01-18T01:42:54.636069
2019-06-13T08:53:25
2019-06-13T08:53:25
7,618,704
0
0
null
null
null
null
UTF-8
C++
false
false
462
cpp
/* Insert Node at the end of a linked list head pointer input could be NULL as well for empty list Node is defined as */ #include<stdlib.h> struct Node { int data; struct Node *next; }; Node* Insert(Node *head,int data) { if(head==NULL){ head = new Node; head -> data=data; head -> next = NULL; } else { Node * t = new Node; t->data=data; t->next=head; head = t; } return head; } int main(){ }
[ "gjmingsg@163.com" ]
gjmingsg@163.com
256f3c6f9e688df3c8318abe40fbd832c1b8f870
49d0403b0eb17fd434f438599281acc61db9e408
/SSSTA/SSSTA7-图论入门/G/g.cpp
66fc7e39836a926ae5135182b4067fcff493d994
[]
no_license
francisfsjiang/ACM
01795c0fd44941ce530e4aa7cfec54ad5f7705f6
5506cc5b9c94ca0866f9ee383676638b74ec5475
refs/heads/master
2021-05-27T01:02:39.419742
2014-02-26T12:45:06
2014-02-26T12:45:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,526
cpp
# include<stdio.h> # include<stdlib.h> # include<string.h> #include<math.h> int edge[500000][2]; double dist[500000]; int pos[505][2]; int fath[505]; int fa(int x) { if(fath[x]==-1) { fath[x]=x; return fath[x]; } else if(fath[x]==x)return x; else { fath[x]=fa(fath[x]); return fath[x]; } } void exchange(int x,int y) { int temp; temp=edge[x][0]; edge[x][0]=edge[y][0]; edge[y][0]=temp; temp=edge[x][1]; edge[x][1]=edge[y][1]; edge[y][1]=temp; double temp2=dist[x]; dist[x]=dist[y]; dist[y]=temp2; } void qs(int s,int t) { int i,j,temp,m; double y; m=rand()%(t-s+1)+s; exchange(m,s); i=s; j=t+1; y=dist[s]; for(;i<j;) { for(i++;dist[i]<y;i++); for(j--;dist[j]>y;j--); if(i<j) { exchange(i,j); } } exchange(s,j); if(s<j-1)qs(s,j-1); if(j+1<t)qs(j+1,t); } int main() { freopen("in.in","r",stdin); freopen("out.out","w",stdout); int i,j,n,edges,x,y; double sum; int sumn; int t,s,p; scanf("%d",&t); while(t--) { scanf("%d%d",&s,&n); memset(fath,-1,sizeof(fath)); edges=0; for(i=0;i<n;i++) { scanf("%d%d",&pos[i][0],&pos[i][1]); } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(j==i)continue; else { edge[edges][0]=i; edge[edges][1]=j; dist[edges]=sqrt((double)(pos[i][0]-pos[j][0])*(pos[i][0]-pos[j][0])+(pos[i][1]-pos[j][1])*(pos[i][1]-pos[j][1])); edges++; } } } //for(i=0;i<edges;i++)printf("%d %d %lf\n",edge[i][0],edge[i][1],dist[i]); qs(0,edges-1); //for(i=0;i<edges;i++)printf("%d %d %lf\n",edge[i][0],edge[i][1],dist[i]); sum=0; sumn=0; for(i=0;i<edges;i++) { x=fa(edge[i][0]); y=fa(edge[i][1]); //printf("%d %d\n",x,y); if(x==y)continue; else { fath[y]=fath[x]; sum+=dist[i]; sumn++; if(sumn==n-s) { printf("%.2lf\n",dist[i]); break; } } } } return 0; }
[ "287459525@qq.com" ]
287459525@qq.com
60e32d6dde98ca97431baa7da2e90e6571a35b7e
adbc979313cbc1f0d42c79ac4206d42a8adb3234
/Source Code/李沿橙 2017-10-3/competition/source/HNSDFZ-欧瀚骏/snakevsblock.cpp
0dbea79f3873597ee7bcbe3baec81c84341aa153
[]
no_license
UnnamedOrange/Contests
a7982c21e575d1342d28c57681a3c98f8afda6c0
d593d56921d2cde0c473b3abedb419bef4cf3ba4
refs/heads/master
2018-10-22T02:26:51.952067
2018-07-21T09:32:29
2018-07-21T09:32:29
112,301,400
1
0
null
null
null
null
UTF-8
C++
false
false
1,901
cpp
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #define N 200 #define L 10000 #define max(a, b) ((a) > (b) ? (a) : (b)) using namespace std; int ans = 0; void update(int &a, int b, int c) { if (b == -1) return ; a = max(a, b + c); } int mx = 0, g[6][6][L + 5], a[N + 5][7], f[N + 5][7], dp[2][7][L + 5], n, m, x, y, r[6]; bool now = 0, pre = 1; void work(int x) { memset(g, -1, sizeof(g)); for (int i = 1; i <= 5; i++) for (int l = 0; l <= mx; l++) g[i][i][l] = dp[now][i][l]; r[5] = 5; for (int i = 4; i; i--) { if (f[x][i]) r[i] = i; else r[i] = r[i + 1]; } for (int i = 1; i < 5; i++) for (int j = 1; i + j <= 5; j++) if (i + j > r[j]) continue; else { for (int l = 0; l <= mx; l++) { if (l - a[x][j] >= 0 && l - a[x][j] <= mx) update(g[j][i + j][l], g[j + 1][i + j][l - a[x][j]], max(0, -a[x][j])); if (l - a[x][i + j] >= 0 && l - a[x][i + j] <= mx) update(g[j][i + j][l], g[j][i + j - 1][l - a[x][i + j]], max(0, -a[x][i + j])); for (int k = j; k <= i + j; k++) update(dp[now][k][l], g[j][i + j][l], 0), ans = max(ans, dp[now][k][l]); } } } int main() { freopen("snakevsblock.in", "r", stdin); freopen("snakevsblock.out", "w", stdout); scanf("%d", &n); for (int i = 1; i <= n; i++) for (int j = 1; j <= 5; j++) { scanf("%d", a[i] + j); mx += max(0, a[i][j]); } scanf("%d", &m); for (int i = 1; i <= m; i++) { scanf("%d%d", &x, &y); f[x][y] = 1; } memset(dp, -1, sizeof(dp)); for (int i = 1; i < 6; i++) if (i == 3) dp[now][i][4] = 0; work(1); for (int i = 2; i <= n; i++) { now ^= 1, pre ^= 1; for (int j = 1; j <= 5; j++) for (int k = 0; k <= mx; k++) if (k - a[i][j] >= 0 && dp[pre][j][k - a[i][j]] != -1) dp[now][j][k] = dp[pre][j][k - a[i][j]] + max(0, -a[i][j]); else dp[now][j][k] = -1; work(i); } printf("%d\n", ans); return 0; }
[ "lycheng1215@sina.com" ]
lycheng1215@sina.com
35c1a041a7ef05f09d1695037bfc7ef37ef5f3f2
e785a1c1ea38813edc5be7d3833d5083b6033b15
/src/qt/addeditadrenalinenode.cpp
4c5b8fa90a6593f160ec0c075af04fec417cf666
[ "MIT" ]
permissive
likewind123/xios
5954c3a727e7cf09277f5c8aa0a97a267472ad9e
82071afad615972cfe86320a4a4fea6654ac951a
refs/heads/master
2022-06-01T21:21:51.118429
2017-11-20T00:44:28
2017-11-20T00:44:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,299
cpp
#include "addeditadrenalinenode.h" #include "ui_addeditadrenalinenode.h" #include "masternodeconfig.h" #include "masternodemanager.h" #include "ui_masternodemanager.h" #include "walletdb.h" #include "wallet.h" #include "ui_interface.h" #include "util.h" #include "key.h" #include "script.h" #include "init.h" #include "base58.h" #include <QMessageBox> #include <QClipboard> AddEditAdrenalineNode::AddEditAdrenalineNode(QWidget *parent) : QDialog(parent), ui(new Ui::AddEditAdrenalineNode) { ui->setupUi(this); //Labels ui->aliasLineEdit->setPlaceholderText("Enter your Masternode alias"); ui->addressLineEdit->setPlaceholderText("Enter your IP & port"); ui->privkeyLineEdit->setPlaceholderText("Enter your Masternode private key"); ui->txhashLineEdit->setPlaceholderText("Enter your 500 XIOS TXID"); ui->outputindexLineEdit->setPlaceholderText("Enter your transaction output index"); ui->rewardaddressLineEdit->setPlaceholderText("Enter a reward recive address"); ui->rewardpercentageLineEdit->setPlaceholderText("Input the % for the reward"); } AddEditAdrenalineNode::~AddEditAdrenalineNode() { delete ui; } void AddEditAdrenalineNode::on_okButton_clicked() { if(ui->aliasLineEdit->text() == "") { QMessageBox msg; msg.setText("Please enter an alias."); msg.exec(); return; } else if(ui->addressLineEdit->text() == "") { QMessageBox msg; msg.setText("Please enter an ip address and port. (123.45.67.89:9999)"); msg.exec(); return; } else if(ui->privkeyLineEdit->text() == "") { QMessageBox msg; msg.setText("Please enter a masternode private key. This can be found using the \"masternode genkey\" command in the console."); msg.exec(); return; } else if(ui->txhashLineEdit->text() == "") { QMessageBox msg; msg.setText("Please enter the transaction hash for the transaction that has 500 coins"); msg.exec(); return; } else if(ui->outputindexLineEdit->text() == "") { QMessageBox msg; msg.setText("Please enter a transaction output index. This can be found using the \"masternode outputs\" command in the console."); msg.exec(); return; } else { std::string sAlias = ui->aliasLineEdit->text().toStdString(); std::string sAddress = ui->addressLineEdit->text().toStdString(); std::string sMasternodePrivKey = ui->privkeyLineEdit->text().toStdString(); std::string sTxHash = ui->txhashLineEdit->text().toStdString(); std::string sOutputIndex = ui->outputindexLineEdit->text().toStdString(); std::string sRewardAddress = ui->rewardaddressLineEdit->text().toStdString(); std::string sRewardPercentage = ui->rewardpercentageLineEdit->text().toStdString(); boost::filesystem::path pathConfigFile = GetDataDir() / "masternode.conf"; boost::filesystem::ofstream stream (pathConfigFile.string(), ios::out | ios::app); if (stream.is_open()) { stream << sAlias << " " << sAddress << " " << sMasternodePrivKey << " " << sTxHash << " " << sOutputIndex; if (sRewardAddress != "" && sRewardPercentage != ""){ stream << " " << sRewardAddress << ":" << sRewardPercentage << std::endl; } else { stream << std::endl; } stream.close(); } masternodeConfig.add(sAlias, sAddress, sMasternodePrivKey, sTxHash, sOutputIndex, sRewardAddress, sRewardPercentage); accept(); } } void AddEditAdrenalineNode::on_cancelButton_clicked() { reject(); } void AddEditAdrenalineNode::on_AddEditAddressPasteButton_clicked() { // Paste text from clipboard into recipient field ui->addressLineEdit->setText(QApplication::clipboard()->text()); } void AddEditAdrenalineNode::on_AddEditPrivkeyPasteButton_clicked() { // Paste text from clipboard into recipient field ui->privkeyLineEdit->setText(QApplication::clipboard()->text()); } void AddEditAdrenalineNode::on_AddEditTxhashPasteButton_clicked() { // Paste text from clipboard into recipient field ui->txhashLineEdit->setText(QApplication::clipboard()->text()); }
[ "dbraford@gmail.com" ]
dbraford@gmail.com
00baadca3c06f89faab2ef4e7ae7235fb528422e
dc2e0d49f99951bc40e323fb92ea4ddd5d9644a0
/Cecily/Activemq-cpp_3.7.1/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/generated/ActiveMQTempQueueMarshaller.cpp
b39a9d2b71a18ef599b6c3fab33d8c5e70999c03
[ "Apache-2.0" ]
permissive
wenyu826/CecilySolution
8696290d1723fdfe6e41ce63e07c7c25a9295ded
14c4ba9adbb937d0ae236040b2752e2c7337b048
refs/heads/master
2020-07-03T06:26:07.875201
2016-11-19T07:04:29
2016-11-19T07:04:29
74,192,785
0
1
null
null
null
null
UTF-8
C++
false
false
4,793
cpp
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ #include <activemq/wireformat/openwire/marshal/generated/ActiveMQTempQueueMarshaller.h> #include <activemq/commands/ActiveMQTempQueue.h> #include <activemq/exceptions/ActiveMQException.h> #include <decaf/lang/Pointer.h> // // NOTE!: This file is autogenerated - do not modify! // if you need to make a change, please see the Java Classes in the // activemq-core module // using namespace std; using namespace activemq; using namespace activemq::exceptions; using namespace activemq::commands; using namespace activemq::wireformat; using namespace activemq::wireformat::openwire; using namespace activemq::wireformat::openwire::marshal; using namespace activemq::wireformat::openwire::utils; using namespace activemq::wireformat::openwire::marshal::generated; using namespace decaf; using namespace decaf::io; using namespace decaf::lang; /////////////////////////////////////////////////////////////////////////////// DataStructure* ActiveMQTempQueueMarshaller::createObject() const { return new ActiveMQTempQueue(); } /////////////////////////////////////////////////////////////////////////////// unsigned char ActiveMQTempQueueMarshaller::getDataStructureType() const { return ActiveMQTempQueue::ID_ACTIVEMQTEMPQUEUE; } /////////////////////////////////////////////////////////////////////////////// void ActiveMQTempQueueMarshaller::tightUnmarshal(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn, BooleanStream* bs) { try { ActiveMQTempDestinationMarshaller::tightUnmarshal(wireFormat, dataStructure, dataIn, bs); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// int ActiveMQTempQueueMarshaller::tightMarshal1(OpenWireFormat* wireFormat, DataStructure* dataStructure, BooleanStream* bs) { try { int rc = ActiveMQTempDestinationMarshaller::tightMarshal1(wireFormat, dataStructure, bs); return rc + 0; } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// void ActiveMQTempQueueMarshaller::tightMarshal2(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut, BooleanStream* bs) { try { ActiveMQTempDestinationMarshaller::tightMarshal2(wireFormat, dataStructure, dataOut, bs ); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// void ActiveMQTempQueueMarshaller::looseUnmarshal(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn) { try { ActiveMQTempDestinationMarshaller::looseUnmarshal(wireFormat, dataStructure, dataIn); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) } /////////////////////////////////////////////////////////////////////////////// void ActiveMQTempQueueMarshaller::looseMarshal(OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut) { try { ActiveMQTempDestinationMarshaller::looseMarshal(wireFormat, dataStructure, dataOut); } AMQ_CATCH_RETHROW(decaf::io::IOException) AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, decaf::io::IOException) AMQ_CATCHALL_THROW(decaf::io::IOException) }
[ "626955115@qq.com" ]
626955115@qq.com
59f292cf7378ec3f32a0ff33bcb247b87e3acf8a
a02d95c61213ca916e44d3ce97ad6757533f6182
/src/tutorials/templates.h
e16178a47cc2c92b53394b81dd15fee83fc1253c
[]
no_license
dan-fritchman/EffectiveModernCppBook
2b4b317a637186d3a0da499f08637faa9d0b2a67
1b8ae59c63901efd14055cf51c4f39ab0b00bd5c
refs/heads/master
2022-12-14T00:12:12.886705
2020-08-25T04:18:37
2020-08-25T04:18:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,282
h
// // Created by Dan Fritchman on 2019-01-09. // #ifndef CPP_TUTORIALS_TEMPLATES_H #define CPP_TUTORIALS_TEMPLATES_H namespace templates { template<typename T> void f(const T &p) { T p3 = p * 3; print(p3); } template<typename T> void g(T &&p) { print(p); } template<typename T> void h(T p) { p = 11; T p4 = 4 * p; print(p4); } template<typename T, std::size_t N> constexpr std::size_t arraySize(T (&)[N]) noexcept { print(N); return N; }; void test_all() { /* * Test some template-based type inference. */ int j = 1; f(j); g(j); h(j); long k = 2; f(k); g(k); h(k); float l = 3.0; f(l); g(l); h(l); double m = 4.0; f(m); g(m); h(m); // Try an array thing or two int arr[] = {1, 2, 3, 4, 5}; print(arr); print(arraySize(arr)); // FIXME: not sure why this part dont work. /*const std::array <int, arraySize(arr)> arr2; array_stuff(arr2); N = arraySize(arr2); std::cout << N << std::endl;*/ } } #endif //CPP_TUTORIALS_TEMPLATES_H
[ "daniel.fritchman@gmail.com" ]
daniel.fritchman@gmail.com
5786c183c0e66f5a39059dfef12b46fb39d2f950
afdf8536a97ffdae17e065cb4611b1cb16062d44
/apps/output_mpi/src/kosaraju_main.cc
8b81c3b3f5c4f88b90067b295303bc8c550b3ad9
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
anchur/DisGCo
6b08e4f86700fb510a148ec802eed40c266e242d
b9b59cb0264ecd2241ffa4d49ef1d71566e6fb48
refs/heads/master
2023-02-13T07:55:36.456648
2021-01-18T05:26:04
2021-01-18T05:26:04
283,666,865
0
0
null
null
null
null
UTF-8
C++
false
false
1,153
cc
#include "common_main.h" #include "kosaraju.h" // defined in generated #include <sys/types.h> #include <unistd.h> class my_main: public main_t { public: int* membership; int num_membership; virtual ~my_main() { delete[] membership; } my_main() : membership(NULL), num_membership(0) { } virtual bool prepare() { membership = new int[G.get_num_of_local_nodes()]; num_membership = 0; return true; } virtual bool run() { num_membership = kosaraju(G, membership); MPI_Barrier(MPI_COMM_WORLD); return true; } virtual bool post_process() { printf("num_membership = %d\n", num_membership); return true; } }; static void wait_for_debugger () { volatile int i=0; fprintf(stderr , "pid %ld waiting for debugger\n" , (long)getpid ()); while(i==0) { /* change 'i' in the debugger */ } MPI_Barrier(MPI_COMM_WORLD); } int main(int argc, char** argv) { int provided; MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); //wait_for_debugger(); my_main M; M.main(argc, argv); MPI_Finalize(); }
[ "anchurs@gmail.com" ]
anchurs@gmail.com
33f6d6f8522377b7583836f11d08f66505b4fc3e
bb65a3b3d17d88bce775bf4e97d37c60fb45413c
/CodeForces/870A/14019555_AC_31ms_4kB.cpp
449fa84728ed111ee62d9dc98dbc854d6c5aabb6
[]
no_license
Tufahel/Vjudge-ACM-Solutions
802502b993891a5a1d2d015087dd946cf5a7a7e0
d60cdc27ff1a0b2da178906bb7450387d2695808
refs/heads/master
2023-06-30T17:26:27.710523
2021-08-05T15:10:58
2021-08-05T15:10:58
393,086,295
3
1
null
null
null
null
UTF-8
C++
false
false
749
cpp
#include<bits/stdc++.h> #define ll long long using namespace std; int main() { ll n,t; cin>>n>>t; ll arr1[n+1],arr2[t+1]; for(ll i=0; i<n; i++) { cin>>arr1[i]; } sort(arr1,arr1+n); for(ll i=0; i<t; i++) { cin>>arr2[i]; } sort(arr2,arr2+t); ll x=0,num[1000]; for(ll i=0; i<t; i++) { for(ll j=0; j<n; j++){ if(arr2[i]==arr1[j]) { cout<<arr2[i]<<endl; return 0; } } } for(ll i=0; i<n; i++) { for(ll j=0; j<t; j++) { num[x++]=arr1[i]*10 + arr2[j]; num[x++]=arr1[i]+ arr2[j]*10; } } sort(num,num+x); cout<<num[0]<<endl; }
[ "60083437+Tufahel@users.noreply.github.com" ]
60083437+Tufahel@users.noreply.github.com
fa5c2635a10f6416d7130cad48488d9ac6e068ab
62bf789f19f500aa5aa20f6911573cc0c59902c7
/green/src/model/UpdateOssStockStatusResult.cc
a64af9688fd7766c42fa2c6eb1314c69d2bea6ee
[ "Apache-2.0" ]
permissive
liuyuhua1984/aliyun-openapi-cpp-sdk
0288f0241812e4308975a62a23fdef2403cfd13a
600883d23a243eb204e39f15505f1f976df57929
refs/heads/master
2020-07-04T09:47:49.901987
2019-08-13T14:13:11
2019-08-13T14:13:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,258
cc
/* * Copyright 2009-2017 Alibaba Cloud 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. */ #include <alibabacloud/green/model/UpdateOssStockStatusResult.h> #include <json/json.h> using namespace AlibabaCloud::Green; using namespace AlibabaCloud::Green::Model; UpdateOssStockStatusResult::UpdateOssStockStatusResult() : ServiceResult() {} UpdateOssStockStatusResult::UpdateOssStockStatusResult(const std::string &payload) : ServiceResult() { parse(payload); } UpdateOssStockStatusResult::~UpdateOssStockStatusResult() {} void UpdateOssStockStatusResult::parse(const std::string &payload) { Json::Reader reader; Json::Value value; reader.parse(payload, value); setRequestId(value["RequestId"].asString()); }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
06a0cb65d3f55f26765b3cce5e23a3dcf2a3f498
680dae9ff7c101aba1a33b22001c1ceea8c2f6f6
/void-core/src/Common/Coroutines/CoroutineManager.cpp
09ffa44e05d13ec95895258ca063d345f278556b
[ "MIT" ]
permissive
m039/Void
af696e237ff3da7683faadc348fe1690d1e0e9fb
1f711a3769f228c9f5edb3377c3370ed68a8e17f
refs/heads/master
2020-12-30T12:45:26.699826
2017-05-16T07:20:00
2017-05-16T07:20:00
91,358,975
1
0
null
null
null
null
UTF-8
C++
false
false
2,111
cpp
// // Created by Dmitry Mozgin on 21/04/2017. // #include "CoroutineManager.h" using namespace vd; CoroutineManager::CoroutineManager() : _inUpdate(false) { } CoroutineManager::~CoroutineManager() { StopAll(); } CoroutineRef CoroutineManager::Start(const Coroutine::EnumerationFunction &enumerator) { auto coroutine = std::make_shared<Coroutine>(enumerator); if (!_inUpdate) { _coroutines.push_back(coroutine); } else { _pendingOperations.push_back([this, coroutine]() { _coroutines.push_back(coroutine); }); } return coroutine; } void CoroutineManager::Stop(const CoroutineRef &coroutine) { if (coroutine == nullptr) return; if (!_inUpdate) { _coroutines.erase( std::find( _coroutines.begin(), _coroutines.end(), coroutine ), _coroutines.end() ); coroutine->Stop(); } else { _pendingOperations.push_back([this, coroutine]() { CoroutineManager::Stop(coroutine); }); } } void CoroutineManager::StopAll() { if (!_inUpdate) { for (auto& c: _coroutines) { c->Stop(); } _coroutines.clear(); } else { _pendingOperations.push_back([this] () { CoroutineManager::StopAll(); }); } } void CoroutineManager::Update() { _inUpdate = true; for (auto& c : _coroutines) { c->Update(); } _inUpdate = false; _coroutines.erase( std::remove_if( _coroutines.begin(), _coroutines.end(), [] (CoroutineRef& coroutine) { return coroutine->IsDone(); } ), _coroutines.end() ); // It could be a call to other functions from the Update. if (_pendingOperations.size() > 0) { for (auto& op: _pendingOperations) { op(); } _pendingOperations.clear(); } }
[ "m0391n@gmail.com" ]
m0391n@gmail.com
29c3c22c60e2995a9f0ded2baaae882181e611d4
e763b855be527d69fb2e824dfb693d09e59cdacb
/aws-cpp-sdk-mobile/include/aws/mobile/model/Resource.h
0b7a650e380319bffc183991f3cf132fbe414c00
[ "MIT", "Apache-2.0", "JSON" ]
permissive
34234344543255455465/aws-sdk-cpp
47de2d7bde504273a43c99188b544e497f743850
1d04ff6389a0ca24361523c58671ad0b2cde56f5
refs/heads/master
2023-06-10T16:15:54.618966
2018-05-07T23:32:08
2018-05-07T23:32:08
132,632,360
1
0
Apache-2.0
2023-06-01T23:20:47
2018-05-08T15:56:35
C++
UTF-8
C++
false
false
6,329
h
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/mobile/Mobile_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/memory/stl/AWSMap.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace Mobile { namespace Model { /** * <p> Information about an instance of an AWS resource associated with a project. * </p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mobile-2017-07-01/Resource">AWS API * Reference</a></p> */ class AWS_MOBILE_API Resource { public: Resource(); Resource(const Aws::Utils::Json::JsonValue& jsonValue); Resource& operator=(const Aws::Utils::Json::JsonValue& jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; inline const Aws::String& GetType() const{ return m_type; } inline void SetType(const Aws::String& value) { m_typeHasBeenSet = true; m_type = value; } inline void SetType(Aws::String&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } inline void SetType(const char* value) { m_typeHasBeenSet = true; m_type.assign(value); } inline Resource& WithType(const Aws::String& value) { SetType(value); return *this;} inline Resource& WithType(Aws::String&& value) { SetType(std::move(value)); return *this;} inline Resource& WithType(const char* value) { SetType(value); return *this;} inline const Aws::String& GetName() const{ return m_name; } inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } inline Resource& WithName(const Aws::String& value) { SetName(value); return *this;} inline Resource& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} inline Resource& WithName(const char* value) { SetName(value); return *this;} inline const Aws::String& GetArn() const{ return m_arn; } inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } inline Resource& WithArn(const Aws::String& value) { SetArn(value); return *this;} inline Resource& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} inline Resource& WithArn(const char* value) { SetArn(value); return *this;} inline const Aws::String& GetFeature() const{ return m_feature; } inline void SetFeature(const Aws::String& value) { m_featureHasBeenSet = true; m_feature = value; } inline void SetFeature(Aws::String&& value) { m_featureHasBeenSet = true; m_feature = std::move(value); } inline void SetFeature(const char* value) { m_featureHasBeenSet = true; m_feature.assign(value); } inline Resource& WithFeature(const Aws::String& value) { SetFeature(value); return *this;} inline Resource& WithFeature(Aws::String&& value) { SetFeature(std::move(value)); return *this;} inline Resource& WithFeature(const char* value) { SetFeature(value); return *this;} inline const Aws::Map<Aws::String, Aws::String>& GetAttributes() const{ return m_attributes; } inline void SetAttributes(const Aws::Map<Aws::String, Aws::String>& value) { m_attributesHasBeenSet = true; m_attributes = value; } inline void SetAttributes(Aws::Map<Aws::String, Aws::String>&& value) { m_attributesHasBeenSet = true; m_attributes = std::move(value); } inline Resource& WithAttributes(const Aws::Map<Aws::String, Aws::String>& value) { SetAttributes(value); return *this;} inline Resource& WithAttributes(Aws::Map<Aws::String, Aws::String>&& value) { SetAttributes(std::move(value)); return *this;} inline Resource& AddAttributes(const Aws::String& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } inline Resource& AddAttributes(Aws::String&& key, const Aws::String& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } inline Resource& AddAttributes(const Aws::String& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } inline Resource& AddAttributes(Aws::String&& key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), std::move(value)); return *this; } inline Resource& AddAttributes(const char* key, Aws::String&& value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, std::move(value)); return *this; } inline Resource& AddAttributes(Aws::String&& key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(std::move(key), value); return *this; } inline Resource& AddAttributes(const char* key, const char* value) { m_attributesHasBeenSet = true; m_attributes.emplace(key, value); return *this; } private: Aws::String m_type; bool m_typeHasBeenSet; Aws::String m_name; bool m_nameHasBeenSet; Aws::String m_arn; bool m_arnHasBeenSet; Aws::String m_feature; bool m_featureHasBeenSet; Aws::Map<Aws::String, Aws::String> m_attributes; bool m_attributesHasBeenSet; }; } // namespace Model } // namespace Mobile } // namespace Aws
[ "henso@amazon.com" ]
henso@amazon.com
5f944f652d8b47b6119c3bb52a4ccb2b1c1d340e
3321f67c972f5bd3372f078da7f74d1a77641c64
/ROS/devel/include/image_rotate/ImageRotateConfig.h
984dd8a4a26d320218233057439a3a365e0a5981
[]
no_license
MarcoAAG/Tesis
fa5a6e266eef2a6634aa1b79fe5d01ee84f03827
f67b5dff172df7fc4bde4f53c117134299e27d6d
refs/heads/master
2021-06-23T06:21:11.139561
2020-08-31T23:19:02
2020-08-31T23:19:02
256,625,266
1
0
null
null
null
null
UTF-8
C++
false
false
37,589
h
//#line 2 "/opt/ros/melodic/share/dynamic_reconfigure/cmake/../templates/ConfigType.h.template" // ********************************************************* // // File autogenerated for the image_rotate package // by the dynamic_reconfigure package. // Please do not edit. // // ********************************************************/ #ifndef __image_rotate__IMAGEROTATECONFIG_H__ #define __image_rotate__IMAGEROTATECONFIG_H__ #if __cplusplus >= 201103L #define DYNAMIC_RECONFIGURE_FINAL final #else #define DYNAMIC_RECONFIGURE_FINAL #endif #include <dynamic_reconfigure/config_tools.h> #include <limits> #include <ros/node_handle.h> #include <dynamic_reconfigure/ConfigDescription.h> #include <dynamic_reconfigure/ParamDescription.h> #include <dynamic_reconfigure/Group.h> #include <dynamic_reconfigure/config_init_mutex.h> #include <boost/any.hpp> namespace image_rotate { class ImageRotateConfigStatics; class ImageRotateConfig { public: class AbstractParamDescription : public dynamic_reconfigure::ParamDescription { public: AbstractParamDescription(std::string n, std::string t, uint32_t l, std::string d, std::string e) { name = n; type = t; level = l; description = d; edit_method = e; } virtual void clamp(ImageRotateConfig &config, const ImageRotateConfig &max, const ImageRotateConfig &min) const = 0; virtual void calcLevel(uint32_t &level, const ImageRotateConfig &config1, const ImageRotateConfig &config2) const = 0; virtual void fromServer(const ros::NodeHandle &nh, ImageRotateConfig &config) const = 0; virtual void toServer(const ros::NodeHandle &nh, const ImageRotateConfig &config) const = 0; virtual bool fromMessage(const dynamic_reconfigure::Config &msg, ImageRotateConfig &config) const = 0; virtual void toMessage(dynamic_reconfigure::Config &msg, const ImageRotateConfig &config) const = 0; virtual void getValue(const ImageRotateConfig &config, boost::any &val) const = 0; }; typedef boost::shared_ptr<AbstractParamDescription> AbstractParamDescriptionPtr; typedef boost::shared_ptr<const AbstractParamDescription> AbstractParamDescriptionConstPtr; // Final keyword added to class because it has virtual methods and inherits // from a class with a non-virtual destructor. template <class T> class ParamDescription DYNAMIC_RECONFIGURE_FINAL : public AbstractParamDescription { public: ParamDescription(std::string a_name, std::string a_type, uint32_t a_level, std::string a_description, std::string a_edit_method, T ImageRotateConfig::* a_f) : AbstractParamDescription(a_name, a_type, a_level, a_description, a_edit_method), field(a_f) {} T ImageRotateConfig::* field; virtual void clamp(ImageRotateConfig &config, const ImageRotateConfig &max, const ImageRotateConfig &min) const { if (config.*field > max.*field) config.*field = max.*field; if (config.*field < min.*field) config.*field = min.*field; } virtual void calcLevel(uint32_t &comb_level, const ImageRotateConfig &config1, const ImageRotateConfig &config2) const { if (config1.*field != config2.*field) comb_level |= level; } virtual void fromServer(const ros::NodeHandle &nh, ImageRotateConfig &config) const { nh.getParam(name, config.*field); } virtual void toServer(const ros::NodeHandle &nh, const ImageRotateConfig &config) const { nh.setParam(name, config.*field); } virtual bool fromMessage(const dynamic_reconfigure::Config &msg, ImageRotateConfig &config) const { return dynamic_reconfigure::ConfigTools::getParameter(msg, name, config.*field); } virtual void toMessage(dynamic_reconfigure::Config &msg, const ImageRotateConfig &config) const { dynamic_reconfigure::ConfigTools::appendParameter(msg, name, config.*field); } virtual void getValue(const ImageRotateConfig &config, boost::any &val) const { val = config.*field; } }; class AbstractGroupDescription : public dynamic_reconfigure::Group { public: AbstractGroupDescription(std::string n, std::string t, int p, int i, bool s) { name = n; type = t; parent = p; state = s; id = i; } std::vector<AbstractParamDescriptionConstPtr> abstract_parameters; bool state; virtual void toMessage(dynamic_reconfigure::Config &msg, const boost::any &config) const = 0; virtual bool fromMessage(const dynamic_reconfigure::Config &msg, boost::any &config) const =0; virtual void updateParams(boost::any &cfg, ImageRotateConfig &top) const= 0; virtual void setInitialState(boost::any &cfg) const = 0; void convertParams() { for(std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = abstract_parameters.begin(); i != abstract_parameters.end(); ++i) { parameters.push_back(dynamic_reconfigure::ParamDescription(**i)); } } }; typedef boost::shared_ptr<AbstractGroupDescription> AbstractGroupDescriptionPtr; typedef boost::shared_ptr<const AbstractGroupDescription> AbstractGroupDescriptionConstPtr; // Final keyword added to class because it has virtual methods and inherits // from a class with a non-virtual destructor. template<class T, class PT> class GroupDescription DYNAMIC_RECONFIGURE_FINAL : public AbstractGroupDescription { public: GroupDescription(std::string a_name, std::string a_type, int a_parent, int a_id, bool a_s, T PT::* a_f) : AbstractGroupDescription(a_name, a_type, a_parent, a_id, a_s), field(a_f) { } GroupDescription(const GroupDescription<T, PT>& g): AbstractGroupDescription(g.name, g.type, g.parent, g.id, g.state), field(g.field), groups(g.groups) { parameters = g.parameters; abstract_parameters = g.abstract_parameters; } virtual bool fromMessage(const dynamic_reconfigure::Config &msg, boost::any &cfg) const { PT* config = boost::any_cast<PT*>(cfg); if(!dynamic_reconfigure::ConfigTools::getGroupState(msg, name, (*config).*field)) return false; for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = groups.begin(); i != groups.end(); ++i) { boost::any n = &((*config).*field); if(!(*i)->fromMessage(msg, n)) return false; } return true; } virtual void setInitialState(boost::any &cfg) const { PT* config = boost::any_cast<PT*>(cfg); T* group = &((*config).*field); group->state = state; for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = groups.begin(); i != groups.end(); ++i) { boost::any n = boost::any(&((*config).*field)); (*i)->setInitialState(n); } } virtual void updateParams(boost::any &cfg, ImageRotateConfig &top) const { PT* config = boost::any_cast<PT*>(cfg); T* f = &((*config).*field); f->setParams(top, abstract_parameters); for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = groups.begin(); i != groups.end(); ++i) { boost::any n = &((*config).*field); (*i)->updateParams(n, top); } } virtual void toMessage(dynamic_reconfigure::Config &msg, const boost::any &cfg) const { const PT config = boost::any_cast<PT>(cfg); dynamic_reconfigure::ConfigTools::appendGroup<T>(msg, name, id, parent, config.*field); for(std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = groups.begin(); i != groups.end(); ++i) { (*i)->toMessage(msg, config.*field); } } T PT::* field; std::vector<ImageRotateConfig::AbstractGroupDescriptionConstPtr> groups; }; class DEFAULT { public: DEFAULT() { state = true; name = "Default"; } void setParams(ImageRotateConfig &config, const std::vector<AbstractParamDescriptionConstPtr> params) { for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator _i = params.begin(); _i != params.end(); ++_i) { boost::any val; (*_i)->getValue(config, val); if("target_frame_id"==(*_i)->name){target_frame_id = boost::any_cast<std::string>(val);} if("target_x"==(*_i)->name){target_x = boost::any_cast<double>(val);} if("target_y"==(*_i)->name){target_y = boost::any_cast<double>(val);} if("target_z"==(*_i)->name){target_z = boost::any_cast<double>(val);} if("source_frame_id"==(*_i)->name){source_frame_id = boost::any_cast<std::string>(val);} if("source_x"==(*_i)->name){source_x = boost::any_cast<double>(val);} if("source_y"==(*_i)->name){source_y = boost::any_cast<double>(val);} if("source_z"==(*_i)->name){source_z = boost::any_cast<double>(val);} if("output_frame_id"==(*_i)->name){output_frame_id = boost::any_cast<std::string>(val);} if("input_frame_id"==(*_i)->name){input_frame_id = boost::any_cast<std::string>(val);} if("use_camera_info"==(*_i)->name){use_camera_info = boost::any_cast<bool>(val);} if("max_angular_rate"==(*_i)->name){max_angular_rate = boost::any_cast<double>(val);} if("output_image_size"==(*_i)->name){output_image_size = boost::any_cast<double>(val);} } } std::string target_frame_id; double target_x; double target_y; double target_z; std::string source_frame_id; double source_x; double source_y; double source_z; std::string output_frame_id; std::string input_frame_id; bool use_camera_info; double max_angular_rate; double output_image_size; bool state; std::string name; }groups; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" std::string target_frame_id; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double target_x; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double target_y; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double target_z; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" std::string source_frame_id; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double source_x; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double source_y; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double source_z; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" std::string output_frame_id; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" std::string input_frame_id; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" bool use_camera_info; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double max_angular_rate; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" double output_image_size; //#line 228 "/opt/ros/melodic/share/dynamic_reconfigure/cmake/../templates/ConfigType.h.template" bool __fromMessage__(dynamic_reconfigure::Config &msg) { const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__(); const std::vector<AbstractGroupDescriptionConstPtr> &__group_descriptions__ = __getGroupDescriptions__(); int count = 0; for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); ++i) if ((*i)->fromMessage(msg, *this)) count++; for (std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = __group_descriptions__.begin(); i != __group_descriptions__.end(); i ++) { if ((*i)->id == 0) { boost::any n = boost::any(this); (*i)->updateParams(n, *this); (*i)->fromMessage(msg, n); } } if (count != dynamic_reconfigure::ConfigTools::size(msg)) { ROS_ERROR("ImageRotateConfig::__fromMessage__ called with an unexpected parameter."); ROS_ERROR("Booleans:"); for (unsigned int i = 0; i < msg.bools.size(); i++) ROS_ERROR(" %s", msg.bools[i].name.c_str()); ROS_ERROR("Integers:"); for (unsigned int i = 0; i < msg.ints.size(); i++) ROS_ERROR(" %s", msg.ints[i].name.c_str()); ROS_ERROR("Doubles:"); for (unsigned int i = 0; i < msg.doubles.size(); i++) ROS_ERROR(" %s", msg.doubles[i].name.c_str()); ROS_ERROR("Strings:"); for (unsigned int i = 0; i < msg.strs.size(); i++) ROS_ERROR(" %s", msg.strs[i].name.c_str()); // @todo Check that there are no duplicates. Make this error more // explicit. return false; } return true; } // This version of __toMessage__ is used during initialization of // statics when __getParamDescriptions__ can't be called yet. void __toMessage__(dynamic_reconfigure::Config &msg, const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__, const std::vector<AbstractGroupDescriptionConstPtr> &__group_descriptions__) const { dynamic_reconfigure::ConfigTools::clear(msg); for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); ++i) (*i)->toMessage(msg, *this); for (std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = __group_descriptions__.begin(); i != __group_descriptions__.end(); ++i) { if((*i)->id == 0) { (*i)->toMessage(msg, *this); } } } void __toMessage__(dynamic_reconfigure::Config &msg) const { const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__(); const std::vector<AbstractGroupDescriptionConstPtr> &__group_descriptions__ = __getGroupDescriptions__(); __toMessage__(msg, __param_descriptions__, __group_descriptions__); } void __toServer__(const ros::NodeHandle &nh) const { const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__(); for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); ++i) (*i)->toServer(nh, *this); } void __fromServer__(const ros::NodeHandle &nh) { static bool setup=false; const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__(); for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); ++i) (*i)->fromServer(nh, *this); const std::vector<AbstractGroupDescriptionConstPtr> &__group_descriptions__ = __getGroupDescriptions__(); for (std::vector<AbstractGroupDescriptionConstPtr>::const_iterator i = __group_descriptions__.begin(); i != __group_descriptions__.end(); i++){ if (!setup && (*i)->id == 0) { setup = true; boost::any n = boost::any(this); (*i)->setInitialState(n); } } } void __clamp__() { const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__(); const ImageRotateConfig &__max__ = __getMax__(); const ImageRotateConfig &__min__ = __getMin__(); for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); ++i) (*i)->clamp(*this, __max__, __min__); } uint32_t __level__(const ImageRotateConfig &config) const { const std::vector<AbstractParamDescriptionConstPtr> &__param_descriptions__ = __getParamDescriptions__(); uint32_t level = 0; for (std::vector<AbstractParamDescriptionConstPtr>::const_iterator i = __param_descriptions__.begin(); i != __param_descriptions__.end(); ++i) (*i)->calcLevel(level, config, *this); return level; } static const dynamic_reconfigure::ConfigDescription &__getDescriptionMessage__(); static const ImageRotateConfig &__getDefault__(); static const ImageRotateConfig &__getMax__(); static const ImageRotateConfig &__getMin__(); static const std::vector<AbstractParamDescriptionConstPtr> &__getParamDescriptions__(); static const std::vector<AbstractGroupDescriptionConstPtr> &__getGroupDescriptions__(); private: static const ImageRotateConfigStatics *__get_statics__(); }; template <> // Max and min are ignored for strings. inline void ImageRotateConfig::ParamDescription<std::string>::clamp(ImageRotateConfig &config, const ImageRotateConfig &max, const ImageRotateConfig &min) const { (void) config; (void) min; (void) max; return; } class ImageRotateConfigStatics { friend class ImageRotateConfig; ImageRotateConfigStatics() { ImageRotateConfig::GroupDescription<ImageRotateConfig::DEFAULT, ImageRotateConfig> Default("Default", "", 0, 0, true, &ImageRotateConfig::groups); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.target_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.target_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.target_frame_id = "base_link"; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("target_frame_id", "str", 0, "Frame in which the target vector is specified. Empty means the input frame.", "", &ImageRotateConfig::target_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("target_frame_id", "str", 0, "Frame in which the target vector is specified. Empty means the input frame.", "", &ImageRotateConfig::target_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.target_x = -10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.target_x = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.target_x = 0.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_x", "double", 0, "X coordinate of the target vector", "", &ImageRotateConfig::target_x))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_x", "double", 0, "X coordinate of the target vector", "", &ImageRotateConfig::target_x))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.target_y = -10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.target_y = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.target_y = 0.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_y", "double", 0, "Y coordinate of the target vector", "", &ImageRotateConfig::target_y))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_y", "double", 0, "Y coordinate of the target vector", "", &ImageRotateConfig::target_y))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.target_z = -10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.target_z = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.target_z = 1.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_z", "double", 0, "Z coordinate of the target vector", "", &ImageRotateConfig::target_z))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("target_z", "double", 0, "Z coordinate of the target vector", "", &ImageRotateConfig::target_z))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.source_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.source_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.source_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("source_frame_id", "str", 0, "Frame in which the source vector is specified. Empty means the input frame.", "", &ImageRotateConfig::source_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("source_frame_id", "str", 0, "Frame in which the source vector is specified. Empty means the input frame.", "", &ImageRotateConfig::source_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.source_x = -10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.source_x = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.source_x = 0.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_x", "double", 0, "X coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_x))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_x", "double", 0, "X coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_x))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.source_y = -10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.source_y = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.source_y = -1.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_y", "double", 0, "Y coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_y))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_y", "double", 0, "Y coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_y))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.source_z = -10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.source_z = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.source_z = 0.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_z", "double", 0, "Z coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_z))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("source_z", "double", 0, "Z coordinate of the direction the target should be aligned with.", "", &ImageRotateConfig::source_z))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.output_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.output_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.output_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("output_frame_id", "str", 0, "Frame to publish for the image's new orientation. Empty means add '_rotated' suffix to the image frame.", "", &ImageRotateConfig::output_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("output_frame_id", "str", 0, "Frame to publish for the image's new orientation. Empty means add '_rotated' suffix to the image frame.", "", &ImageRotateConfig::output_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.input_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.input_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.input_frame_id = ""; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("input_frame_id", "str", 0, "Frame to use for the original camera image. Empty means that the frame in the image or camera_info should be used depending on use_camera_info.", "", &ImageRotateConfig::input_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<std::string>("input_frame_id", "str", 0, "Frame to use for the original camera image. Empty means that the frame in the image or camera_info should be used depending on use_camera_info.", "", &ImageRotateConfig::input_frame_id))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.use_camera_info = 0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.use_camera_info = 1; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.use_camera_info = 1; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<bool>("use_camera_info", "bool", 0, "Indicates that the camera_info topic should be subscribed to to get the default input_frame_id. Otherwise the frame from the image message will be used.", "", &ImageRotateConfig::use_camera_info))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<bool>("use_camera_info", "bool", 0, "Indicates that the camera_info topic should be subscribed to to get the default input_frame_id. Otherwise the frame from the image message will be used.", "", &ImageRotateConfig::use_camera_info))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.max_angular_rate = 0.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.max_angular_rate = 100.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.max_angular_rate = 10.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("max_angular_rate", "double", 0, "Limits the rate at which the image can rotate (rad/s). Zero means no limit.", "", &ImageRotateConfig::max_angular_rate))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("max_angular_rate", "double", 0, "Limits the rate at which the image can rotate (rad/s). Zero means no limit.", "", &ImageRotateConfig::max_angular_rate))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __min__.output_image_size = 0.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __max__.output_image_size = 3.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __default__.output_image_size = 2.0; //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.abstract_parameters.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("output_image_size", "double", 0, "Size of the output image as a function of the input image size. Can be varied continuously between the following special settings: 0 ensures no black ever appears, 1 is small image dimension, 2 is large image dimension, 3 is image diagonal.", "", &ImageRotateConfig::output_image_size))); //#line 291 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __param_descriptions__.push_back(ImageRotateConfig::AbstractParamDescriptionConstPtr(new ImageRotateConfig::ParamDescription<double>("output_image_size", "double", 0, "Size of the output image as a function of the input image size. Can be varied continuously between the following special settings: 0 ensures no black ever appears, 1 is small image dimension, 2 is large image dimension, 3 is image diagonal.", "", &ImageRotateConfig::output_image_size))); //#line 246 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" Default.convertParams(); //#line 246 "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/parameter_generator_catkin.py" __group_descriptions__.push_back(ImageRotateConfig::AbstractGroupDescriptionConstPtr(new ImageRotateConfig::GroupDescription<ImageRotateConfig::DEFAULT, ImageRotateConfig>(Default))); //#line 366 "/opt/ros/melodic/share/dynamic_reconfigure/cmake/../templates/ConfigType.h.template" for (std::vector<ImageRotateConfig::AbstractGroupDescriptionConstPtr>::const_iterator i = __group_descriptions__.begin(); i != __group_descriptions__.end(); ++i) { __description_message__.groups.push_back(**i); } __max__.__toMessage__(__description_message__.max, __param_descriptions__, __group_descriptions__); __min__.__toMessage__(__description_message__.min, __param_descriptions__, __group_descriptions__); __default__.__toMessage__(__description_message__.dflt, __param_descriptions__, __group_descriptions__); } std::vector<ImageRotateConfig::AbstractParamDescriptionConstPtr> __param_descriptions__; std::vector<ImageRotateConfig::AbstractGroupDescriptionConstPtr> __group_descriptions__; ImageRotateConfig __max__; ImageRotateConfig __min__; ImageRotateConfig __default__; dynamic_reconfigure::ConfigDescription __description_message__; static const ImageRotateConfigStatics *get_instance() { // Split this off in a separate function because I know that // instance will get initialized the first time get_instance is // called, and I am guaranteeing that get_instance gets called at // most once. static ImageRotateConfigStatics instance; return &instance; } }; inline const dynamic_reconfigure::ConfigDescription &ImageRotateConfig::__getDescriptionMessage__() { return __get_statics__()->__description_message__; } inline const ImageRotateConfig &ImageRotateConfig::__getDefault__() { return __get_statics__()->__default__; } inline const ImageRotateConfig &ImageRotateConfig::__getMax__() { return __get_statics__()->__max__; } inline const ImageRotateConfig &ImageRotateConfig::__getMin__() { return __get_statics__()->__min__; } inline const std::vector<ImageRotateConfig::AbstractParamDescriptionConstPtr> &ImageRotateConfig::__getParamDescriptions__() { return __get_statics__()->__param_descriptions__; } inline const std::vector<ImageRotateConfig::AbstractGroupDescriptionConstPtr> &ImageRotateConfig::__getGroupDescriptions__() { return __get_statics__()->__group_descriptions__; } inline const ImageRotateConfigStatics *ImageRotateConfig::__get_statics__() { const static ImageRotateConfigStatics *statics; if (statics) // Common case return statics; boost::mutex::scoped_lock lock(dynamic_reconfigure::__init_mutex__); if (statics) // In case we lost a race. return statics; statics = ImageRotateConfigStatics::get_instance(); return statics; } } #undef DYNAMIC_RECONFIGURE_FINAL #endif // __IMAGEROTATERECONFIGURATOR_H__
[ "marco-antonioa@outlook.com" ]
marco-antonioa@outlook.com
2ea5db7f12072f999a3104db47a6d88903700486
fb98fed853c57c7c79c38c0aa3b90ab66d046475
/prajinjo/src/sr.cpp
0a96ccea3aed5b73ad9e2495c037b896e8238bc7
[]
no_license
pjonchhe/reliable_transport_protocol
2da898339895c58288320cbf9f32aaca92fb0ebf
43f53e5785cd72206a6becae2b1babbd4e6f8251
refs/heads/master
2021-09-02T02:37:47.119865
2017-12-29T19:40:16
2017-12-29T19:40:16
110,907,840
0
0
null
null
null
null
UTF-8
C++
false
false
8,916
cpp
#include "../include/simulator.h" #include <stdio.h> #include <string.h> #include <stdlib.h> /* ****************************************************************** ALTERNATING BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose This code should be used for PA2, unidirectional data transfer protocols (from A to B). Network properties: - one way network delay averages five time units (longer if there are other messages in the channel for GBN), but can be larger - packets can be corrupted (either the header or the data portion) or lost, according to user-defined probabilities - packets will be delivered in the order in which they were sent (although some can be lost). **********************************************************************/ #define TIMEOUT_VAL 18 int nextSeqNum_A, maxSeqNum_A; int expectedSeqNum_B, maxSeqNum_B; struct node { struct node* next; struct pkt pktBuf; int timeOut; bool bAckReceived; }; struct node *head_A, *tail_A; struct node *winHead_A, *winTail_A; int numUnACK; struct node *head_B, *tail_B; int numBuf_B; struct pkt sndPkt_B; float timer = 1.0; void A_make_send_pkt(); /********* STUDENTS WRITE THE NEXT SEVEN ROUTINES *********/ /* called from layer 5, passed the data to be sent to other side */ void A_output(struct msg message) { struct node* tempMsg = (struct node*)malloc(sizeof(struct node)); memset(tempMsg->pktBuf.payload, 0, 20); memcpy(tempMsg->pktBuf.payload, message.data, sizeof(message.data)); tempMsg->bAckReceived = false; tempMsg->next = NULL; if(head_A == NULL) { head_A = tempMsg; tail_A = tempMsg; } else { tail_A->next = tempMsg; tail_A = tempMsg; } printf("Buffer message : %c\n", tempMsg->pktBuf.payload[0]); if(head_A == tail_A) { winHead_A = head_A; winTail_A = tail_A; } A_make_send_pkt(); } void A_make_send_pkt() { int sum = 0; if(NULL == head_A) return; printf("numUnACK = %d\n", numUnACK); struct node* tempBuf = winHead_A; if(numUnACK >= getwinsize()) printf("Window FULL !!!\n"); while(numUnACK < getwinsize()) { if(numUnACK == 0) winTail_A = winHead_A; else if(winTail_A->next != NULL) winTail_A = winTail_A->next; else if(winTail_A->next == NULL) return; winTail_A->pktBuf.seqnum = nextSeqNum_A; winTail_A->pktBuf.acknum = 0; if(nextSeqNum_A == maxSeqNum_A) nextSeqNum_A = 0; else nextSeqNum_A ++; sum = winTail_A->pktBuf.seqnum + winTail_A->pktBuf.acknum; for(int i = 0; i < sizeof(winTail_A->pktBuf.payload); i++) sum = sum + (int)(winTail_A->pktBuf.payload[i]); winTail_A->pktBuf.checksum = sum; printf("sending : %c %d\n", winTail_A->pktBuf.payload[0], winTail_A->pktBuf.seqnum); tolayer3(0, winTail_A->pktBuf); winTail_A->timeOut = TIMEOUT_VAL; winTail_A->bAckReceived = false; if(numUnACK == 0) starttimer(0, timer); numUnACK ++; if(winTail_A->next == NULL) break; } } /* called from layer 3, when a packet arrives for layer 4 */ void A_input(struct pkt packet) { int sum = 0; bool corrupt = true; sum = packet.seqnum + packet.acknum; printf("A_input Final sum is %d\n", sum); if(sum == packet.checksum) corrupt = false; else printf("A_input packet corrupt!!\n"); if(corrupt) return; if(!corrupt) { printf("Received ACK for %d\n", packet.acknum); struct node* tempNode = winHead_A; if(winHead_A == NULL) return; while(tempNode && tempNode->pktBuf.seqnum != packet.acknum) { tempNode = tempNode->next; } if(tempNode == NULL) { // Already ACK received. return; } if(tempNode->pktBuf.seqnum == packet.acknum) { tempNode->bAckReceived = true; tempNode->timeOut = 0; } if(tempNode == winHead_A) { while(winHead_A && winHead_A->bAckReceived != false) { winHead_A = winHead_A->next; free(tempNode); tempNode = winHead_A; head_A = winHead_A; numUnACK--; } } if(numUnACK == 0) stoptimer(0); A_make_send_pkt(); } } /* called when A's timer goes off */ void A_timerinterrupt() { struct node* tempNode = winHead_A; while(tempNode && tempNode != winTail_A) { tempNode->timeOut--; if(tempNode->timeOut == 0) { tolayer3(0, tempNode->pktBuf); printf("Sending again : %c %d\n", tempNode->pktBuf.payload[0], tempNode->pktBuf.seqnum); tempNode->timeOut = TIMEOUT_VAL; } tempNode = tempNode->next; } //Check the last one also. if(tempNode && tempNode == winTail_A) { tempNode->timeOut--; if(tempNode->timeOut == 0) { printf("Sending again : %c %d\n", tempNode->pktBuf.payload[0], tempNode->pktBuf.seqnum); tolayer3(0, tempNode->pktBuf); tempNode->timeOut = TIMEOUT_VAL; } } if(numUnACK != 0) starttimer(0, timer); } /* the following routine will be called once (only) before any other */ /* entity A routines are called. You can use it to do any initialization */ void A_init() { nextSeqNum_A = 0; //maxSeqNum_A = getwinsize() * 2; maxSeqNum_A = 1000; numUnACK = 0; head_A = NULL; tail_A = NULL; winHead_A = NULL; winTail_A = NULL; } /* Note that with simplex transfer from a-to-B, there is no B_output() */ /* called from layer 3, when a packet arrives for layer 4 at B*/ void B_input(struct pkt packet) { int sum = 0; bool corrupt = true; int checksum; sum = packet.seqnum + packet.acknum; printf("B_input seq = %d checksum = %d\n", packet.seqnum, packet.checksum); for(int i = 0; i < sizeof(packet.payload); i++) { sum = sum + (int)packet.payload[i]; } printf("B_input Final sum is %d\n", sum); if(sum == packet.checksum) corrupt = false; else printf("B_input packet corrupt!!\n"); if(!corrupt) { sndPkt_B.seqnum = packet.seqnum; sndPkt_B.acknum = packet.seqnum; sum = sndPkt_B.seqnum + sndPkt_B.acknum; printf("B_input ack = %d\n", sndPkt_B.acknum); printf("packet.seqnum = %d expectedSeqNum_B = %d numBuf = %d\n",packet.seqnum, expectedSeqNum_B, numBuf_B); sndPkt_B.checksum = sum; tolayer3(1, sndPkt_B); if(packet.seqnum == expectedSeqNum_B) { char tempMsg[20]; memset(tempMsg, 0, 20); memcpy(tempMsg, packet.payload, sizeof(packet.payload)); printf("tempMsg = %c \n", tempMsg[0]); printf("Send aboce1 at b = %c\n", tempMsg[0]); tolayer5(1, tempMsg); if(expectedSeqNum_B == maxSeqNum_B) { expectedSeqNum_B = 0; } else { expectedSeqNum_B++; } if(numBuf_B != 0) { while(head_B && head_B->pktBuf.seqnum == expectedSeqNum_B) { struct node* tempNode = head_B; memset(tempMsg, 0, 20); memcpy(tempMsg, tempNode->pktBuf.payload, sizeof(tempNode->pktBuf.payload)); printf("Send aboce2 at b = %c\n", tempMsg[0]); tolayer5(1, tempMsg); head_B = head_B->next; free(tempNode); numBuf_B --; if(expectedSeqNum_B == maxSeqNum_B) expectedSeqNum_B = 0; else expectedSeqNum_B++; } } printf("After sendig numBuf = %d\n", numBuf_B); } else { if((((expectedSeqNum_B + getwinsize() -1) <= maxSeqNum_B) && (packet.seqnum > expectedSeqNum_B) && (packet.seqnum <= (expectedSeqNum_B + getwinsize() -1))) || (((expectedSeqNum_B + getwinsize() -1) > maxSeqNum_B) && (((packet.seqnum > expectedSeqNum_B) && (packet.seqnum <= maxSeqNum_B)) || (packet.seqnum < (expectedSeqNum_B + getwinsize() -1 - maxSeqNum_B - 1))))) { //Need to check if already buffered. struct node* checkNode = head_B; bool bBuffered = false; while(checkNode) { if(checkNode->pktBuf.seqnum == packet.seqnum) { bBuffered = true; break; } checkNode = checkNode->next; } if(bBuffered) return; struct node* tempNode = (struct node*)malloc(sizeof(struct node)); memset(tempNode->pktBuf.payload, 0, 20); memcpy(tempNode->pktBuf.payload, packet.payload, sizeof(packet.payload)); tempNode->pktBuf.seqnum = packet.seqnum; tempNode->pktBuf.acknum = packet.acknum; tempNode->next = NULL; printf("buffer at B = %c\n", packet.payload[0]); if(head_B == NULL) { head_B = tempNode; tail_B = tempNode; } else { if(tempNode->pktBuf.seqnum < head_B->pktBuf.seqnum) { tempNode->next = head_B; head_B = tempNode; } else { struct node* traverse = head_B; while(traverse->next != NULL && traverse->next->pktBuf.seqnum < tempNode->pktBuf.seqnum) traverse = traverse->next; tempNode->next = traverse->next; traverse->next = tempNode; if(tempNode->next == NULL) tail_B = tempNode; } } numBuf_B ++; } } } } /* the following rouytine will be called once (only) before any other */ /* entity B routines are called. You can use it to do any initialization */ void B_init() { head_B = NULL; tail_B = NULL; sndPkt_B.seqnum = 0; sndPkt_B.acknum = -1; sndPkt_B.checksum = 0; memset(sndPkt_B.payload, 0, 20); expectedSeqNum_B = 0; //maxSeqNum_B = getwinsize() * 2; maxSeqNum_B = 1000; }
[ "prajinjo@buffalo.edu" ]
prajinjo@buffalo.edu
787229ac960db705ac3447e9a13f732322f5da6e
5ec53d7afb645bfaf2620ba1267186054b92d84d
/PID_Lab/test/arduino_speak/arduino_speak.ino
60ea54b32a59a7ad9feb6964b298df7fd04ee364
[]
no_license
zhathawa/ENGR-131B
d515b5ce2f69c6ad2211389979205baac7096c9f
5ea169ec3b7e742f7bbf0285c7b6e415002ebda0
refs/heads/master
2020-04-17T05:23:32.865510
2019-11-26T17:02:57
2019-11-26T17:02:57
166,276,529
0
1
null
null
null
null
UTF-8
C++
false
false
1,017
ino
#include "ardy.h" #include "commands.h" #include "joystick.h" #include "pulse_gen.h" #include "ultra.h" #include "states.h" // pointer for commands char* options; // chars read from serial line int charsRead; // serial message stored here char msg[50]; // main interface with our various functions Ardy ardy; // setup void setup() { // initialize our commands struct init_commands(&cmds); // start serial communication Serial.begin(115200); // give everything time to set up delay(500); // inform user Serial.println("Ready!"); } void loop() { // check that we have things to read if (Serial.available()) { // read from serial port charsRead = Serial.readBytesUntil('\n', msg, sizeof(msg) - 1); // make c string msg[charsRead] = '\0'; // parse and set commands up set_commands(&cmds, msg); } // we can do things if (cmds.func == "PUL") { // PULSE if (ardy.get_pgen().get_state() == ON) { ardy.pulse(); return; } } }
[ "zach.hathaway48@gmail.com" ]
zach.hathaway48@gmail.com
1a12f264af2401db5d058ee1ab301a3e672211a1
a623bb4db329c8d63e03908d16dc2808bacbcdaa
/include/vRt/Parts/Enums.inl
750274b2e64cba6f6b2b9afcaf69bee4ab97c3a0
[ "MIT" ]
permissive
gitter-badger/vRt
990358412ec885352d3893bf80fdc286e01d170c
a50b67d42a7d8eb0735016337ec7f482a2bde253
refs/heads/master
2020-03-19T12:14:12.155526
2018-06-07T12:54:32
2018-06-07T12:54:32
136,505,385
0
0
MIT
2018-06-07T16:41:44
2018-06-07T16:41:44
null
UTF-8
C++
false
false
2,509
inl
#pragma once #include "Headers.inl" #include "StructuresLow.inl" namespace vt { // store in official namespace // for not confusing with Vulkan API // use 0x11E for VtResult // use 0x11F for VtStructureType // planned merge ray tracing exclusive errors typedef VkResult VtResult; typedef enum VtPipelineBindPoint: uint32_t { VT_PIPELINE_BIND_POINT_RAY_TRACING = 0x11F00000, VT_PIPELINE_BIND_POINT_ACCELERATOR = 0x11F00001 // unknown } VtPipelineBindPoint; typedef enum VtStructureType: uint32_t { VT_STRUCTURE_TYPE_INSTANCE_CONVERSION_INFO = 0x11F00000, VT_STRUCTURE_TYPE_DEVICE_CONVERSION_INFO = 0x11F00001, VT_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONVERSION_INFO = 0x11F00002, VT_STRUCTURE_TYPE_RAY_TRACING_CREATE_INFO = 0x11F00003, VT_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO = 0x11F00004, VT_STRUCTURE_TYPE_VERTEX_INPUT_CREATE_INFO = 0x11F00005, VT_STRUCTURE_TYPE_DEVICE_BUFFER_CREATE_INFO = 0x11F00006, VT_STRUCTURE_TYPE_DEVICE_IMAGE_CREATE_INFO = 0x11F00007, VT_STRUCTURE_TYPE_DEVICE_TO_HOST_BUFFER_CREATE_INFO = 0x11F00008, VT_STRUCTURE_TYPE_DEVICE_TO_HOST_IMAGE_CREATE_INFO = 0x11F00009, VT_STRUCTURE_TYPE_HOST_TO_DEVICE_BUFFER_CREATE_INFO = 0x11F0000A, VT_STRUCTURE_TYPE_HOST_TO_DEVICE_IMAGE_CREATE_INFO = 0x11F0000B, VT_STRUCTURE_TYPE_MATERIAL_SET_CREATE_INFO = 0x11F0000C, VT_STRUCTURE_TYPE_ACCELERATOR_CREATE_INFO = 0x11F0000D, VT_STRUCTURE_TYPE_ARTIFICAL_DEVICE_EXTENSION = 0x11F0000E } VtStructureType; // retype VtFormatDecomp using VtFormat = VtFormatDecomp; // use constexpr VtFormat constants constexpr auto VT_R32G32B32A32_SFLOAT = VtFormatDecomp(4u, VT_FLOAT), VT_R32G32B32_SFLOAT = VtFormatDecomp(3u, VT_FLOAT), VT_R32G32_SFLOAT = VtFormatDecomp(2u, VT_FLOAT), VT_R32_SFLOAT = VtFormatDecomp(1u, VT_FLOAT), VT_R32_UINT = VtFormatDecomp(1u, VT_UINT32), VT_R16_UINT = VtFormatDecomp(1u, VT_UINT16); // all supported topologies typedef enum VtTopologyType: uint32_t { VT_TOPOLOGY_TYPE_TRIANGLES_LIST = 0x11F00000 } VtTopologyType; // ray tracing pipeline usages typedef enum VtEntryUsageFlags : uint32_t { VT_ENTRY_USAGE_CLOSEST = 0x00000001, VT_ENTRY_USAGE_MISS = 0x00000002, VT_ENTRY_USAGE_GENERATION = 0x00000004, VT_ENTRY_USAGE_RESOLVE = 0x00000008, } VtEntryUsageFlags; };
[ "33594593+elviras9t@users.noreply.github.com" ]
33594593+elviras9t@users.noreply.github.com
40407ff135ccad0a4e3228b35e1fb91727b2dcc8
51c373c677af476f9e0af12232c610bb624c3486
/CougSat1-IHU/src/drivers/CSRI.h
187c2afed7db1dee87ccd458c6feb9f88fe8f0d9
[]
no_license
KendrickMitchell/CIS-temp2-
2560e506a60db6651bf159f94320e52e7ee255fa
a09f5032b411c359155fc03dbd9c6f5854198093
refs/heads/master
2020-04-25T08:23:23.858052
2018-12-01T22:44:05
2018-12-01T22:44:05
172,645,548
0
0
null
null
null
null
UTF-8
C++
false
false
1,696
h
/****************************************************************************** * Copyright (c) 2017 by Cougs in Space - Washington State University * * Cougs in Space website: cis.vcea.wsu.edu * * * * This file is a part of flight and/or ground software for Cougs in Space's * * satellites. This file is proprietary and confidential. * * Unauthorized copying of this file, via any medium is strictly prohibited. * ******************************************************************************/ /** * @file CSRI.cpp * @author Bradley Davis * @date 10 Dec 2017 * @brief Formats a raw image into the CSRI format * * Cougs in Space Raw Image (CSRI) format is a wrapper file of raw pixel data * */ #ifndef SRC_DRIVERS_CSRI_H_ #define SRC_DRIVERS_CSRI_H_ #include <mbed.h> #define RESOLUTION_VGA 0x028001E0 #define RESOLUTION_1280x960 0x050003C0 #define RESOLUTION_2000x1500 0x07D005DC #define RESOLUTION_2592x1944 0x0A200768 enum PixelLocation{ NW = 0, NE, SW, SE }; enum BayerFormat{ RGGB = 0, BGGR, GBRG, GRBG }; #define CSRI_RESOL_SHIFT 6 #define CSRI_PIXEL_SHIFT 4 #define CSRI_BAYER_SHIFT 2 #define CSRI_DEPTH_SHIFT 1 #define CSRI_COMPR_SHIFT 0 class CSRI { public: static uint8_t rawToCSRI(char *srcPath, char *dstPath, uint32_t resolution, PixelLocation firstPixel, BayerFormat bayerFormat, uint8_t bitDepth, bool compressData); static uint8_t writeHeaderCSRI(FILE *file, uint32_t resolution, PixelLocation firstPixel, BayerFormat bayerFormat, uint8_t bitDepth); }; #endif /* SRC_DRIVERS_CSRI_H_ */
[ "bradley.l.davis@wsu.edu" ]
bradley.l.davis@wsu.edu
55bcef5fa5a3b2892dd80a5b5972129c58e5f577
4e1130e548ec59e55d91ccaecc2123e57ec079d8
/CppND-Capstone-Snake-Game/src/main.cpp
909ff52353868b70ca133a1be7b467ef4f842de7
[]
no_license
mykhani/CPP_Udacit_ND
95f0da75e38e64b63e5eaed0f069a6233bfcb924
d919ec3679f650f5b35f0880fb4d66ac9d3cd6fd
refs/heads/master
2022-07-16T19:45:22.328476
2020-05-17T23:24:02
2020-05-17T23:24:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
726
cpp
#include <iostream> #include "controller.h" #include "game.h" #include "renderer.h" int main() { constexpr std::size_t kFramesPerSecond{60}; constexpr std::size_t kMsPerFrame{1000 / kFramesPerSecond}; constexpr std::size_t kScreenWidth{640}; constexpr std::size_t kScreenHeight{640}; constexpr std::size_t kGridWidth{32}; constexpr std::size_t kGridHeight{32}; //[AH]: definition of the snake, controller and renderer will be part of the game class Game game(kScreenWidth, kScreenHeight,kGridWidth, kGridHeight); game.Run(kMsPerFrame); std::cout << "Game has terminated successfully!\n"; std::cout << "Score: " << game.GetScore() << "\n"; std::cout << "Size: " << game.GetSize() << "\n"; return 0; }
[ "ahmhashesh@gmail.com" ]
ahmhashesh@gmail.com
a2bda1a79c761d33939e4e91ff72086b97da8a55
080e7f5eeb768b87d3cbae2e37f2942e4197a327
/数据结构与算法.算法设计题/快速排序一趟.cpp
c0ad70aac24ff49a732296aea9b6529bedfbd0a6
[]
no_license
yhshu/Data-Structures-and-Algorithms
9c4087d4b1c6d6f117323076f77f066809392493
b2359b33a4c54694a25707d6139c4e46f2df45c2
refs/heads/master
2021-09-14T13:44:15.450133
2018-05-14T15:04:09
2018-05-14T15:04:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
578
cpp
// 设有一组初始记录关键字序列K1到Kn,要求设计一个算法能在O(n)的时间复杂度内将线性表分为两部分,其中左半部分的每个关键字均小于K1,右半部分的每个关键字均大于K1 void quick_sort(int a[], int start, int end) { int pivot = a[start]; int i = start, j; for (j = start + 1; j <= end - 1; j++) { if (a[j] <= pivot) { i++; swap(a, i, j); } swap(a, i + 1, start); } } void swap(int &a[], int i, int j) { int t = a[j]; a[j] = a[i]; a[i] = t; }
[ "lzw429@qq.com" ]
lzw429@qq.com
3fa9010c06a88ddd18911df6e67d10a35395712c
18235c9cd03db2879f9158e462e1fcbadf936c6d
/src/gpu/gradients/GrGradientShader.cpp
4fe5266aee2473ea9874c99e175d57d392d6038a
[ "BSD-3-Clause", "SGI-B-2.0" ]
permissive
LineageOS/android_external_skia
1ffccc50c8c65acdc91a420aa55ef38e752576a5
e519a019ae513c4cf640e2122c66224f569f79cb
refs/heads/lineage-17.1
2022-10-23T10:17:35.983361
2021-09-09T12:44:51
2021-09-09T12:44:51
75,638,325
1
62
BSD-3-Clause
2022-10-02T20:13:32
2016-12-05T15:29:07
C++
UTF-8
C++
false
false
14,225
cpp
/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrGradientShader.h" #include "GrClampedGradientEffect.h" #include "GrTiledGradientEffect.h" #include "GrLinearGradientLayout.h" #include "GrRadialGradientLayout.h" #include "GrSweepGradientLayout.h" #include "GrTwoPointConicalGradientLayout.h" #include "GrDualIntervalGradientColorizer.h" #include "GrSingleIntervalGradientColorizer.h" #include "GrTextureGradientColorizer.h" #include "GrUnrolledBinaryGradientColorizer.h" #include "GrGradientBitmapCache.h" #include "GrCaps.h" #include "GrColor.h" #include "GrColorSpaceInfo.h" #include "GrRecordingContext.h" #include "GrRecordingContextPriv.h" #include "SkGr.h" // Intervals smaller than this (that aren't hard stops) on low-precision-only devices force us to // use the textured gradient static const SkScalar kLowPrecisionIntervalLimit = 0.01f; // Each cache entry costs 1K or 2K of RAM. Each bitmap will be 1x256 at either 32bpp or 64bpp. static const int kMaxNumCachedGradientBitmaps = 32; static const int kGradientTextureSize = 256; // NOTE: signature takes raw pointers to the color/pos arrays and a count to make it easy for // MakeColorizer to transparently take care of hard stops at the end points of the gradient. static std::unique_ptr<GrFragmentProcessor> make_textured_colorizer(const SkPMColor4f* colors, const SkScalar* positions, int count, bool premul, const GrFPArgs& args) { static GrGradientBitmapCache gCache(kMaxNumCachedGradientBitmaps, kGradientTextureSize); // Use 8888 or F16, depending on the destination config. // TODO: Use 1010102 for opaque gradients, at least if destination is 1010102? SkColorType colorType = kRGBA_8888_SkColorType; if (kLow_GrSLPrecision != GrSLSamplerPrecision(args.fDstColorSpaceInfo->config()) && args.fContext->priv().caps()->isConfigTexturable(kRGBA_half_GrPixelConfig)) { colorType = kRGBA_F16_SkColorType; } SkAlphaType alphaType = premul ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; SkBitmap bitmap; gCache.getGradient(colors, positions, count, colorType, alphaType, &bitmap); SkASSERT(1 == bitmap.height() && SkIsPow2(bitmap.width())); SkASSERT(bitmap.isImmutable()); sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy( args.fContext->priv().proxyProvider(), bitmap); if (proxy == nullptr) { SkDebugf("Gradient won't draw. Could not create texture."); return nullptr; } return GrTextureGradientColorizer::Make(std::move(proxy)); } // Analyze the shader's color stops and positions and chooses an appropriate colorizer to represent // the gradient. static std::unique_ptr<GrFragmentProcessor> make_colorizer(const SkPMColor4f* colors, const SkScalar* positions, int count, bool premul, const GrFPArgs& args) { // If there are hard stops at the beginning or end, the first and/or last color should be // ignored by the colorizer since it should only be used in a clamped border color. By detecting // and removing these stops at the beginning, it makes optimizing the remaining color stops // simpler. // SkGradientShaderBase guarantees that pos[0] == 0 by adding a dummy bool bottomHardStop = SkScalarNearlyEqual(positions[0], positions[1]); // The same is true for pos[end] == 1 bool topHardStop = SkScalarNearlyEqual(positions[count - 2], positions[count - 1]); int offset = 0; if (bottomHardStop) { offset += 1; count--; } if (topHardStop) { count--; } // Two remaining colors means a single interval from 0 to 1 // (but it may have originally been a 3 or 4 color gradient with 1-2 hard stops at the ends) if (count == 2) { return GrSingleIntervalGradientColorizer::Make(colors[offset], colors[offset + 1]); } // Do an early test for the texture fallback to skip all of the other tests for specific // analytic support of the gradient (and compatibility with the hardware), when it's definitely // impossible to use an analytic solution. bool tryAnalyticColorizer = count <= GrUnrolledBinaryGradientColorizer::kMaxColorCount; // The remaining analytic colorizers use scale*t+bias, and the scale/bias values can become // quite large when thresholds are close (but still outside the hardstop limit). If float isn't // 32-bit, output can be incorrect if the thresholds are too close together. However, the // analytic shaders are higher quality, so they can be used with lower precision hardware when // the thresholds are not ill-conditioned. const GrShaderCaps* caps = args.fContext->priv().caps()->shaderCaps(); if (!caps->floatIs32Bits() && tryAnalyticColorizer) { // Could run into problems, check if thresholds are close together (with a limit of .01, so // that scales will be less than 100, which leaves 4 decimals of precision on 16-bit). for (int i = offset; i < count - 1; i++) { SkScalar dt = SkScalarAbs(positions[i] - positions[i + 1]); if (dt <= kLowPrecisionIntervalLimit && dt > SK_ScalarNearlyZero) { tryAnalyticColorizer = false; break; } } } if (tryAnalyticColorizer) { if (count == 3) { // Must be a dual interval gradient, where the middle point is at offset+1 and the two // intervals share the middle color stop. return GrDualIntervalGradientColorizer::Make(colors[offset], colors[offset + 1], colors[offset + 1], colors[offset + 2], positions[offset + 1]); } else if (count == 4 && SkScalarNearlyEqual(positions[offset + 1], positions[offset + 2])) { // Two separate intervals that join at the same threshold position return GrDualIntervalGradientColorizer::Make(colors[offset], colors[offset + 1], colors[offset + 2], colors[offset + 3], positions[offset + 1]); } // The single and dual intervals are a specialized case of the unrolled binary search // colorizer which can analytically render gradients of up to 8 intervals (up to 9 or 16 // colors depending on how many hard stops are inserted). std::unique_ptr<GrFragmentProcessor> unrolled = GrUnrolledBinaryGradientColorizer::Make( colors + offset, positions + offset, count); if (unrolled) { return unrolled; } } // Otherwise fall back to a rasterized gradient sampled by a texture, which can handle // arbitrary gradients (the only downside being sampling resolution). return make_textured_colorizer(colors + offset, positions + offset, count, premul, args); } // Combines the colorizer and layout with an appropriately configured master effect based on the // gradient's tile mode static std::unique_ptr<GrFragmentProcessor> make_gradient(const SkGradientShaderBase& shader, const GrFPArgs& args, std::unique_ptr<GrFragmentProcessor> layout) { // No shader is possible if a layout couldn't be created, e.g. a layout-specific Make() returned // null. if (layout == nullptr) { return nullptr; } // Convert all colors into destination space and into SkPMColor4fs, and handle // premul issues depending on the interpolation mode bool inputPremul = shader.getGradFlags() & SkGradientShader::kInterpolateColorsInPremul_Flag; bool allOpaque = true; SkAutoSTMalloc<4, SkPMColor4f> colors(shader.fColorCount); SkColor4fXformer xformedColors(shader.fOrigColors4f, shader.fColorCount, shader.fColorSpace.get(), args.fDstColorSpaceInfo->colorSpace()); for (int i = 0; i < shader.fColorCount; i++) { const SkColor4f& upmColor = xformedColors.fColors[i]; colors[i] = inputPremul ? upmColor.premul() : SkPMColor4f{ upmColor.fR, upmColor.fG, upmColor.fB, upmColor.fA }; if (allOpaque && !SkScalarNearlyEqual(colors[i].fA, 1.0)) { allOpaque = false; } } // SkGradientShader stores positions implicitly when they are evenly spaced, but the getPos() // implementation performs a branch for every position index. Since the shader conversion // requires lots of position tests, calculate all of the positions up front if needed. SkTArray<SkScalar, true> implicitPos; SkScalar* positions; if (shader.fOrigPos) { positions = shader.fOrigPos; } else { implicitPos.reserve(shader.fColorCount); SkScalar posScale = SK_Scalar1 / (shader.fColorCount - 1); for (int i = 0 ; i < shader.fColorCount; i++) { implicitPos.push_back(SkIntToScalar(i) * posScale); } positions = implicitPos.begin(); } // All gradients are colorized the same way, regardless of layout std::unique_ptr<GrFragmentProcessor> colorizer = make_colorizer( colors.get(), positions, shader.fColorCount, inputPremul, args); if (colorizer == nullptr) { return nullptr; } // The master effect has to export premul colors, but under certain conditions it doesn't need // to do anything to achieve that: i.e. its interpolating already premul colors (inputPremul) // or all the colors have a = 1, in which case premul is a no op. Note that this allOpaque // check is more permissive than SkGradientShaderBase's isOpaque(), since we can optimize away // the make-premul op for two point conical gradients (which report false for isOpaque). bool makePremul = !inputPremul && !allOpaque; // All tile modes are supported (unless something was added to SkShader) std::unique_ptr<GrFragmentProcessor> master; switch(shader.getTileMode()) { case SkShader::kRepeat_TileMode: master = GrTiledGradientEffect::Make(std::move(colorizer), std::move(layout), /* mirror */ false, makePremul, allOpaque); break; case SkShader::kMirror_TileMode: master = GrTiledGradientEffect::Make(std::move(colorizer), std::move(layout), /* mirror */ true, makePremul, allOpaque); break; case SkShader::kClamp_TileMode: // For the clamped mode, the border colors are the first and last colors, corresponding // to t=0 and t=1, because SkGradientShaderBase enforces that by adding color stops as // appropriate. If there is a hard stop, this grabs the expected outer colors for the // border. master = GrClampedGradientEffect::Make(std::move(colorizer), std::move(layout), colors[0], colors[shader.fColorCount - 1], makePremul, allOpaque); break; case SkShader::kDecal_TileMode: // Even if the gradient colors are opaque, the decal borders are transparent so // disable that optimization master = GrClampedGradientEffect::Make(std::move(colorizer), std::move(layout), SK_PMColor4fTRANSPARENT, SK_PMColor4fTRANSPARENT, makePremul, /* colorsAreOpaque */ false); break; } if (master == nullptr) { // Unexpected tile mode return nullptr; } if (args.fInputColorIsOpaque) { return GrFragmentProcessor::OverrideInput(std::move(master), SK_PMColor4fWHITE, false); } return GrFragmentProcessor::MulChildByInputAlpha(std::move(master)); } namespace GrGradientShader { std::unique_ptr<GrFragmentProcessor> MakeLinear(const SkLinearGradient& shader, const GrFPArgs& args) { return make_gradient(shader, args, GrLinearGradientLayout::Make(shader, args)); } std::unique_ptr<GrFragmentProcessor> MakeRadial(const SkRadialGradient& shader, const GrFPArgs& args) { return make_gradient(shader,args, GrRadialGradientLayout::Make(shader, args)); } std::unique_ptr<GrFragmentProcessor> MakeSweep(const SkSweepGradient& shader, const GrFPArgs& args) { return make_gradient(shader,args, GrSweepGradientLayout::Make(shader, args)); } std::unique_ptr<GrFragmentProcessor> MakeConical(const SkTwoPointConicalGradient& shader, const GrFPArgs& args) { return make_gradient(shader, args, GrTwoPointConicalGradientLayout::Make(shader, args)); } #if GR_TEST_UTILS RandomParams::RandomParams(SkRandom* random) { // Set color count to min of 2 so that we don't trigger the const color optimization and make // a non-gradient processor. fColorCount = random->nextRangeU(2, kMaxRandomGradientColors); fUseColors4f = random->nextBool(); // if one color, omit stops, otherwise randomly decide whether or not to if (fColorCount == 1 || (fColorCount >= 2 && random->nextBool())) { fStops = nullptr; } else { fStops = fStopStorage; } // if using SkColor4f, attach a random (possibly null) color space (with linear gamma) if (fUseColors4f) { fColorSpace = GrTest::TestColorSpace(random); } SkScalar stop = 0.f; for (int i = 0; i < fColorCount; ++i) { if (fUseColors4f) { fColors4f[i].fR = random->nextUScalar1(); fColors4f[i].fG = random->nextUScalar1(); fColors4f[i].fB = random->nextUScalar1(); fColors4f[i].fA = random->nextUScalar1(); } else { fColors[i] = random->nextU(); } if (fStops) { fStops[i] = stop; stop = i < fColorCount - 1 ? stop + random->nextUScalar1() * (1.f - stop) : 1.f; } } fTileMode = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileModeCount)); } #endif }
[ "skia-commit-bot@chromium.org" ]
skia-commit-bot@chromium.org
6a5ee8979a285ee91fa8240d85ed357d3b564c7c
60f5e5d75aac439f11276caa4998dc392b02b9b7
/src/main/native/FunctionPointerUtils_Win.cpp
c5a0c162f40bdd1b32c7a4df6461248fb97840ba
[ "MIT" ]
permissive
gpu/JOCL
85046f2747740790ac1a9ce80178489e8edf3766
2db325a411039046b41a6d28c9e70ae09398dc43
refs/heads/master
2023-05-14T10:51:32.969534
2023-05-06T15:19:12
2023-05-06T15:19:12
1,185,036
174
45
NOASSERTION
2022-06-15T20:07:36
2010-12-20T18:40:29
Java
UTF-8
C++
false
false
2,854
cpp
/* * JOCL - Java bindings for OpenCL * * Copyright (c) 2009-2012 Marco Hutter - http://www.jocl.org * * 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. */ #ifdef _WIN32 #include "FunctionPointerUtils.hpp" #include "Logger.hpp" #include <windows.h> HMODULE libraryHandle = NULL; /** * The address of the function with the given name is obtained from * the library and returned */ intptr_t obtainFunctionPointer(const char* name) { SetLastError(0); intptr_t result = (intptr_t)GetProcAddress(libraryHandle, name); DWORD lastError = GetLastError(); if (lastError != 0) { //printf("Function pointer %p for %s - ERROR %d\n", result, name, lastError); SetLastError(0); } else { //printf("Function pointer %p for %s\n", result, name); } return result; } /** * Prepare the initialization of the function pointers by loading * the specified library. Returns whether this initialization * succeeded. */ bool loadImplementationLibrary(const char *libraryName) { SetLastError(0); libraryHandle = LoadLibrary(libraryName); if (libraryHandle == NULL) { DWORD lastError = GetLastError(); SetLastError(0); Logger::log(LOG_ERROR, "Could not load %s, error %ld\n", libraryName, lastError); return false; } return true; } /** * Unload the OpenCL library */ bool unloadImplementationLibrary() { if (libraryHandle != NULL) { SetLastError(0); FreeLibrary(libraryHandle); DWORD lastError = GetLastError(); if (lastError != 0) { Logger::log(LOG_ERROR, "Could not unload implementation library, error %ld\n", lastError); SetLastError(0); return false; } } return true; } #endif // _WIN32
[ "jocl@jocl.org" ]
jocl@jocl.org
5ce1972bbc2400f02cf3bcceab51901c316d4404
db179759b7f3b1afb80b5efec032a38e615154d3
/Development/Src/D3D9Drv/Src/D3D9Util.cpp
5d96c321369bd5d61407ce649e162b00a10e9270
[]
no_license
xukunn1226/VRI3
b263c6df957cefb8a347ff8feb7a90a491e28715
47c536220d60f04ccaccb275f65d63d717e25ac5
refs/heads/master
2016-09-09T22:34:51.370275
2013-02-18T16:09:31
2013-02-18T16:09:31
8,271,770
1
0
null
null
null
null
UTF-8
C++
false
false
3,312
cpp
#include "D3D9DrvPCH.h" FString GetD3DErrorString(HRESULT ErrorCode) { FString ErrorText; #define D3DERR(x) case x : ErrorText = TEXT(#x); break; switch(ErrorCode) { D3DERR(D3D_OK) D3DERR(D3DERR_WRONGTEXTUREFORMAT) D3DERR(D3DERR_UNSUPPORTEDCOLOROPERATION) D3DERR(D3DERR_UNSUPPORTEDCOLORARG) D3DERR(D3DERR_UNSUPPORTEDALPHAOPERATION) D3DERR(D3DERR_UNSUPPORTEDALPHAARG) D3DERR(D3DERR_TOOMANYOPERATIONS) D3DERR(D3DERR_CONFLICTINGTEXTUREFILTER) D3DERR(D3DERR_UNSUPPORTEDFACTORVALUE) D3DERR(D3DERR_CONFLICTINGRENDERSTATE) D3DERR(D3DERR_UNSUPPORTEDTEXTUREFILTER) D3DERR(D3DERR_CONFLICTINGTEXTUREPALETTE) D3DERR(D3DERR_DRIVERINTERNALERROR) D3DERR(D3DERR_NOTFOUND) D3DERR(D3DERR_MOREDATA) D3DERR(D3DERR_DEVICELOST) D3DERR(D3DERR_DEVICENOTRESET) D3DERR(D3DERR_NOTAVAILABLE) D3DERR(D3DERR_OUTOFVIDEOMEMORY) D3DERR(D3DERR_INVALIDDEVICE) D3DERR(D3DERR_INVALIDCALL) D3DERR(D3DERR_DRIVERINVALIDCALL) D3DERR(D3DXERR_INVALIDDATA) D3DERR(E_OUTOFMEMORY) default: ErrorText = FStringUtil::Sprintf(TEXT("Unknown Error Code")); } #undef D3DERR return ErrorText; } FString GetD3DTextureFormatString(D3DFORMAT TextureFormat) { FString FormatText; #define TEXTURECASE(x) case x : FormatText = TEXT(#x); break; switch(TextureFormat) { TEXTURECASE(D3DFMT_A8R8G8B8) TEXTURECASE(D3DFMT_X8R8G8B8) TEXTURECASE(D3DFMT_DXT1) TEXTURECASE(D3DFMT_DXT3) TEXTURECASE(D3DFMT_DXT5) TEXTURECASE(D3DFMT_A16B16G16R16F) TEXTURECASE(D3DFMT_A32B32G32R32F) TEXTURECASE(D3DFMT_UNKNOWN) TEXTURECASE(D3DFMT_L8) TEXTURECASE(D3DFMT_UYVY) TEXTURECASE(D3DFMT_D24S8) TEXTURECASE(D3DFMT_D24X8) TEXTURECASE(D3DFMT_R32F) TEXTURECASE(D3DFMT_G16R16) TEXTURECASE(D3DFMT_G16R16F) TEXTURECASE(D3DFMT_G32R32F) TEXTURECASE(D3DFMT_A2B10G10R10) TEXTURECASE(D3DFMT_A16B16G16R16) default: FormatText = FStringUtil::Sprintf(TEXT("Unknown Texture Format")); } #undef TEXTURECASE return FormatText; } FString GetD3DTextureFlagString(DWORD TextureFlags) { FString TextureText; if( TextureFlags & D3DUSAGE_DEPTHSTENCIL ) { TextureText += FString(TEXT("D3DUSAGE_DEPTHSTENCIL")); } if( TextureFlags & D3DUSAGE_RENDERTARGET ) { TextureText += FString(TEXT("D3DUSAGE_RENDERTARGET")); } return TextureText; } void VerifyD3DResult(HRESULT Result, const ANSICHAR* ErrorCode, const ANSICHAR* Filename, UINT Line) { if( FAILED(Result) ) { const FString& ErrorString = GetD3DErrorString(Result); debugf(NAME_Error, TEXT("%s failed \n at %s:%u \n with error %s"), ANSI_TO_TCHAR(ErrorCode), ANSI_TO_TCHAR(Filename), Line, ErrorString); } } void VerifyD3DCreateTextureResult(HRESULT Result, const ANSICHAR* ErrorCode, const ANSICHAR* Filename, UINT Line, UINT SizeX, UINT SizeY, BYTE D3DFormat, UINT NumMips, DWORD Flags) { if( FAILED(Result) ) { const FString& ErrorString = GetD3DErrorString(Result); const FString& D3DFormatString = GetD3DTextureFormatString((D3DFORMAT)GPixelFormats[D3DFormat].PlatformFormat); debugf( NAME_Error, TEXT("%s failed \n at %s:%u with error %s, \n SizeX=%i, SizeY=%i, Format=%s=%s, NumMips=%i, Flags=%s"), ANSI_TO_TCHAR(ErrorCode), ANSI_TO_TCHAR(Filename), Line, ErrorString, SizeX, SizeY, GPixelFormats[D3DFormat].Name, D3DFormatString, NumMips, GetD3DTextureFlagString(Flags)); } }
[ "xukunn1226@gmail.com" ]
xukunn1226@gmail.com
04639d846d58360f6850749b0f3f2bd0b2067622
3420718f59993749d60b1439f4c6cceca129a123
/CODES/google_code_jam/prc.cpp
4b4ff0005a02735c2da985e8daf6f5d4d3ef8316
[]
no_license
melvinvarkey/CompetitiveProgramming
6f38b4a0d72621d31b65bc786c2522043fe59fd6
c49ad082ce07daa6a2a5c9cbd7b10d3df84c9fe1
refs/heads/master
2020-12-30T21:59:51.491269
2014-10-08T11:59:50
2014-10-08T11:59:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
906
cpp
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int main() { freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int i,j,k,n,len,p1,p2,cas=0; char s1[5000]; // char c=' '; cin>>n; // n+=1; for(k=0;k<n;k++) { cout<<"Case #"<<k+1<<": "; lab: gets(s1); len=strlen(s1); if(len==0) goto lab; p2=len-1; for(i=(len-1);i>=0;i--) { if(s1[i]==' ' || i==0) { j=i+1; if(i==0) j=0; for(;j<=p2;j++) { cout<<s1[j];} cout<<" "; p2=i-1; } } cout<<endl; } return 0; }
[ "shabaz1729@gmail.com" ]
shabaz1729@gmail.com
7db38f8bcf853aa4129073ae8587851446859ebe
77157987168fc6a0827df2ecdd55104813be77b1
/CNull/inst/testfiles/communities_individual_based_sampling_alpha/libFuzzer_communities_individual_based_sampling_alpha/communities_individual_based_sampling_alpha_DeepState_TestHarness.cpp
eb5ab4d68bae47023580d977295a0a15b20a3503
[]
no_license
akhikolla/updatedatatype-list2
e8758b374f9a18fd3ef07664f1150e14a2e4c3d8
a3a519440e02d89640c75207c73c1456cf86487d
refs/heads/master
2023-03-21T13:17:13.762823
2021-03-20T15:46:49
2021-03-20T15:46:49
349,766,184
0
0
null
null
null
null
UTF-8
C++
false
false
1,811
cpp
// AUTOMATICALLY GENERATED BY RCPPDEEPSTATE PLEASE DO NOT EDIT BY HAND, INSTEAD EDIT // communities_individual_based_sampling_alpha_DeepState_TestHarness_generation.cpp and communities_individual_based_sampling_alpha_DeepState_TestHarness_checks.cpp #include <fstream> #include <RInside.h> #include <iostream> #include <RcppDeepState.h> #include <qs.h> #include <DeepState.hpp> NumericMatrix communities_individual_based_sampling_alpha(NumericMatrix in_m, int repetitions); TEST(,){ static int rinside_flag = 0; if(rinside_flag == 0) { rinside_flag = 1; RInside R; } std::time_t current_timestamp = std::time(0); std::cout << "input starts" << std::endl; NumericMatrix in_m = RcppDeepState_NumericMatrix(); std::string in_m_t = "/home/akhila/fuzzer_packages/fuzzedpackages/CNull/inst/testfiles/communities_individual_based_sampling_alpha/libFuzzer_communities_individual_based_sampling_alpha/libfuzzer_inputs/" + std::to_string(current_timestamp) + "_in_m.qs"; qs::c_qsave(in_m,in_m_t, "high", "zstd", 1, 15, true, 1); std::cout << "in_m values: "<< in_m << std::endl; IntegerVector repetitions(1); repetitions[0] = RcppDeepState_int(); std::string repetitions_t = "/home/akhila/fuzzer_packages/fuzzedpackages/CNull/inst/testfiles/communities_individual_based_sampling_alpha/libFuzzer_communities_individual_based_sampling_alpha/libfuzzer_inputs/" + std::to_string(current_timestamp) + "_repetitions.qs"; qs::c_qsave(repetitions,repetitions_t, "high", "zstd", 1, 15, true, 1); std::cout << "repetitions values: "<< repetitions << std::endl; std::cout << "input ends" << std::endl; try{ communities_individual_based_sampling_alpha(in_m,repetitions[0]); } catch(Rcpp::exception& e){ std::cout<<"Exception Handled"<<std::endl; } }
[ "akhilakollasrinu424jf@gmail.com" ]
akhilakollasrinu424jf@gmail.com
53881069ab3381cad2ec91ec5afe1b3fcd8be1a1
f0b7bcc41298354b471a72a7eeafe349aa8655bf
/codebase/apps/Radx/src/RadxModelQc/AzGradientFilter.cc
255792aee5e8b4c6d4e5b6bc391ede6b125cee38
[ "BSD-3-Clause" ]
permissive
NCAR/lrose-core
23abeb4e4f1b287725dc659fb566a293aba70069
be0d059240ca442883ae2993b6aa112011755688
refs/heads/master
2023-09-01T04:01:36.030960
2023-08-25T00:41:16
2023-08-25T00:41:16
51,408,988
90
53
NOASSERTION
2023-08-18T21:59:40
2016-02-09T23:36:25
C++
UTF-8
C++
false
false
6,794
cc
#include "AzGradientFilter.hh" #include "AzGradientStateSpecialData.hh" #include "RayData1.hh" #include <Radx/RadxRay.hh> #include <Radx/RayxData.hh> #include <radar/RadxApp.hh> #include <toolsa/LogStream.hh> #include <vector> #include <string> //---------------------------------------------------------------------- AzGradientFilter::AzGradientFilter(void) {} //---------------------------------------------------------------------- AzGradientFilter::~AzGradientFilter(void) {} //---------------------------------------------------------------------- bool AzGradientFilter::filter(const AzGradientStateSpecialData &state, double v, const RayxData &rdata, const std::string &name, const RayData1 &rdata1, RadxAppRayLoopData *output) { _state = &state; // get the field from the center ray //RayxData r, r0, r1; RayxData r0, r1; RayxData r(rdata); // if (!RayData::retrieveRay(name, *ray, _data, r, true)) // { // return false; // } const RadxRay *lray0 = NULL; const RadxRay *lray1 = NULL; // see if can proceed or not bool ok = _setAdjacentRays(rdata1, &lray0, &lray1); if (ok) { if (!RadxApp::retrieveRay(name, *lray0, r0)) { return false; } if (!RadxApp::retrieveRay(name, *lray1, r1)) { return false; } // // this is wrong for 0th ray because rdata1 will be used, but // // it is not set for the previous ray // if (!RayData::retrieveRay(name, *lray0, rdata1.dataRef(), r0)) // { // return false; // } // // this is wrong for all rays because rdata1 wil be used, but it // // is not set for the next ray // if (!RayData::retrieveRay(name, *lray1, rdata1.dataRef(), r1)) // { // return false; // } int n = r.getNpoints(); int n0 = r0.getNpoints(); int n1 = r1.getNpoints(); int nend = n; double a0 = r0.getAzimuth(); double a1 = r1.getAzimuth(); if (n0 < nend) nend = n0; if (n1 < nend) nend = n1; if (v > 0) { r.inc(v); r0.inc(v); r1.inc(v); } for (int i=0; i<nend; ++i) { double v0, v1; if (r0.getV(i, v0) && r1.getV(i, v1)) { output->setVal(i, (v1 - v0)/(a1-a0)/2.0); } else { output->setVal(i, output->getMissingValue()); } } for (int i=nend; i<n; ++i) { output->setVal(i, output->getMissingValue()); } } else { output->setAllToValue(output->getMissingValue()); } return true; } //------------------------------------------------------------------ bool AzGradientFilter:: _setAdjacentRays(const RayData1 &rdata1, const RadxRay **lray0, const RadxRay **lray1) const { if (rdata1.prevMissing() && rdata1.nextMissing()) { // don't know what this is LOG(ERROR) << "Missing two of 3 inputs, not expected"; return false; } else if (rdata1.prevMissing() && !rdata1.nextMissing()) { return _veryFirstRay(rdata1, lray0, lray1); } else if ((!rdata1.prevMissing()) && rdata1.nextMissing()) { return _veryLastRay(rdata1, lray0, lray1); } else { *lray0 = rdata1.r0Ptr(); *lray1 = rdata1.r1Ptr(); // check for sweep boundary int s0 = (*lray0)->getSweepNumber(); int s1 = (*lray1)->getSweepNumber(); int s = rdata1.rPtr()->getSweepNumber(); if (s0 != s && s1 == s) { // current starts a new sweep return _setPreviousRayWhenNewSweep(s0, s, lray0, lray1); } else if (s0 == s && s1 != s) { // current ends a new sweep return _setNextRayWhenEndSweep(s, s1, lray0, lray1); } else { return true; } } } //------------------------------------------------------------------ bool AzGradientFilter::_setPreviousRayWhenNewSweep(int oldSweep, int sweep, const RadxRay **lray0, const RadxRay **lray1) const { if (oldSweep >= sweep) { LOG(ERROR) << "Sweep indices did not increase"; return false; } // crossed the boundary with s, if 360 can use last ray int nState = static_cast<int>(_state->size()); for (int j=0; j<nState; ++j) { if ((*_state)[j]._sweepNumber == sweep && (*_state)[j]._is360) { *lray0 = (*_state)[j]._ray1; LOG(DEBUG_VERBOSE) << "new sweep starts now " << sweep << "full 360 so prev=last in sweep"; return true; } } LOG(WARNING) << "new sweep starts now " << sweep << " not full 360, leave gap here"; return false; } //------------------------------------------------------------------ bool AzGradientFilter::_setNextRayWhenEndSweep(int sweep, int nextSweep, const RadxRay **lray0, const RadxRay **lray1) const { if (sweep >= nextSweep) { LOG(ERROR) << "Sweep indices did not increase"; return false; } // crossed boundary when look to next ray, of 360 can use 0th ray as next one int nState = static_cast<int>(_state->size()); for (int j=0; j<nState; ++j) { if ((*_state)[j]._sweepNumber == sweep && (*_state)[j]._is360) { *lray1 = (*_state)[j]._ray0; LOG(DEBUG_VERBOSE) << "last ray in sweep "<< sweep << " full 360, so next = 0th in sweep"; return true; } } LOG(WARNING) << "last ray in sweep" << sweep << " not full 360, leave gap"; return false; } //------------------------------------------------------------------ bool AzGradientFilter::_veryFirstRay(const RayData1 &rdata1, const RadxRay **lray0, const RadxRay **lray1) const { // case of no previous ray, should be the 0th ray in the 0th sweep. // if so, if 360, can use the last ray in the 0th sweep as ray0 int s = rdata1.rPtr()->getSweepNumber(); if (s == (*_state)[0]._sweepNumber && (*_state)[0]._is360) { LOG(DEBUG_VERBOSE) << "First ray in vol, 360, set previous to last in sweep"; *lray0 = (*_state)[0]._ray1; *lray1 = rdata1.r1Ptr(); return true; } else { LOG(DEBUG_VERBOSE) << "First ray and not 360, leave a gap at 0"; return false; } } //------------------------------------------------------------------ bool AzGradientFilter::_veryLastRay(const RayData1 &rdata1, const RadxRay **lray0, const RadxRay **lray1) const { // case of no next ray, should be last ray in last sweep. If so, if 360, // can use first ray in last weep as ray1 int s = rdata1.rPtr()->getSweepNumber(); int nState = static_cast<int>(_state->size()); if (s == (*_state)[nState-1]._sweepNumber && (*_state)[nState-1]._is360) { LOG(DEBUG_VERBOSE) << "Last ray in vol, 360, set next to 0th in sweep"; *lray0 = rdata1.r0Ptr(); *lray1 = (*_state)[nState-1]._ray0; return true; } else { LOG(DEBUG_VERBOSE) << "Last ray and not 360, leave a gap at last position"; return false; } }
[ "dixon@ucar.edu" ]
dixon@ucar.edu
bed45ad82c8a16a76b592d7cd9e40f15ddf221d5
c97cb7e29c8e7319ba23a78f5bc30bdf1dbe0117
/src/camera/camera.hpp
e7abe635bd5eff719d25a11a63cbe1b87a987193
[]
no_license
nagato0614/nagatoRender
5693211c5e971209bdcc03c8848a5ac2ea73a40b
822d6f0d250e979a9355f789c23cc988e5842d75
refs/heads/master
2020-07-02T11:08:19.535123
2019-11-17T16:02:56
2019-11-17T16:02:56
201,505,961
0
0
null
null
null
null
UTF-8
C++
false
false
875
hpp
// // Created by 長井亨 on 2019-08-10. // #ifndef NAGATO_RENDER_SRC_CAMERA_CAMERA_HPP_ #define NAGATO_RENDER_SRC_CAMERA_CAMERA_HPP_ #include "nagato.hpp" #include "ray.hpp" namespace nagato { class Camera { public: virtual Ray GeneratePrimaryRay(int x, int y) const = 0; Camera(const Vector3f &lookfrom, const Vector3f &up, const Vector3f &lookat, Float fov, int width, int height); protected: /** * カメラ中心座標 */ Vector3f lookfrom_; /** * カメラのセンター位置 */ Vector3f lookat_; /** * カメラの上方向 */ Vector3f up_; /** * field of view */ Float fov_; /** * アスペクト比 */ Float aspect_; /** * スクリーン幅 */ int width_; /** * スクリーン高さ */ int height_; }; } #endif //NAGATO_RENDER_SRC_CAMERA_CAMERA_HPP_
[ "nagato0614@gmail.com" ]
nagato0614@gmail.com
2f64fd0e7b45dbe27745a2613abeeb6b2b5055fd
3af68b32aaa9b7522a1718b0fc50ef0cf4a704a9
/cpp/A/C/B/B/D/AACBBD.cpp
0bea9266bb24ca0be075576f0df07cf03b6f2f94
[]
no_license
devsisters/2021-NDC-ICECREAM
7cd09fa2794cbab1ab4702362a37f6ab62638d9b
ac6548f443a75b86d9e9151ff9c1b17c792b2afd
refs/heads/master
2023-03-19T06:29:03.216461
2021-03-10T02:53:14
2021-03-10T02:53:14
341,872,233
0
0
null
null
null
null
UTF-8
C++
false
false
108
cpp
#include "AACBBD.h" namespace AACBBD { std::string run() { std::string out("AACBBD"); return out; } }
[ "nakhyun@devsisters.com" ]
nakhyun@devsisters.com
f466788fc22c9c65a62bb83467d4194a56f13226
57a3942322461889bc62e349385d5345466de421
/misionerodedios-tenor2.inc
44f3078fac41a8e8027721eaab24088882af12c3
[]
no_license
cjsjb/misionerodedios
f054e934b3051fa5d90df2c28a482a86e2edbdc9
93d3f343148f9f3738a4b0a7d9644cc057ee9413
refs/heads/master
2022-10-29T18:31:28.725350
2022-10-14T02:21:25
2022-10-14T02:21:25
145,914,992
0
0
null
null
null
null
UTF-8
C++
false
false
5,059
inc
\context Staff = "Músicos" \with { \consists Ambitus_engraver } << \set Staff.instrumentName = "Tenor II" \set Staff.shortInstrumentName = "T.2" \set Score.skipBars = ##t \set Staff.printKeyCancellation = ##f \new Voice \global \new Voice \globalTempo \context Voice = "voz-tenor2" { \override Voice.TextScript #'padding = #2.0 \override MultiMeasureRest #'expand-limit = 1 %\clef "tenor" \clef "treble_8" \key a \major R1*10 | % [2] estrofa 1 r4 e 16. e e 8 e e e 8. | e 8 e 16 e 8 e fis 8. gis 4. | r4 a 8 a 16 a 8. gis 8 fis e | gis 1 | r4 r8 d d d e fis | gis 8 gis gis a 4 b e 8 | cis' 8 cis' cis' cis' b a gis a ~ | a 1 | % [3] estrofa 2 r4 cis' a cis' | b 2 a 4 b | r4 cis' a cis' | gis 1 | r4 d e fis | gis 4. a 4 b e 8 | cis' 4 cis' 8 b 4 a 8 gis a ~ | a 1 | % [4] puente 1 r8 a a a a b a b ~ | b 8 e 2 r8 e cis' ~ | cis' 4 cis' 8 b 4 b a 8 ~ | a 1 | r8 a a a a gis a b ~ | b 8 b 4 r8 b a gis a ~ | a 1 | R1 | % [5] coro 1 r8 a a gis 4 e 8 gis fis ~ | fis 8 r r4 r2 | r8 a a gis 4 e 8 gis fis ( ~ | fis 4. gis 8 ~ gis 2 ) | r8 a a a b cis' d' d' ~ | d' 8 cis' b cis' 4 ( b 8 a a ) | r8 e e e e e e e ~ | % [6] interludio e 1 | R1*7 | % [7] estrofa 3 r4 e 16. e e 8 e e e 8. | e 8 e 16 e 8 e fis 8. gis 4. | r4 a 8 a 16 a 8 gis fis e 8. | gis 1 | r8 d d d d d e fis | gis 8 gis gis a 4 b e 8 | cis' 8 cis' cis' cis' b a gis a ~ | a 1 | % [8] estrofa 4 r4 cis' a cis' | b 2 a 4 b | r4 cis' a cis' | gis 1 | r4 d e fis | gis 4. a 4 b r8 | cis' 8 cis' cis' cis' b a gis a ~ | a 1 | % [9] puente 2 r8 a a a a b a b ~ | b 8 e 2 e 8 e cis' ~ | cis' 4 cis' 8 b 4 b a 8 ~ | a 1 | r4 a 8 a 4 gis 8 a b ~ | b 8 b r4 b 8 a gis a ~ | a 1 | R1 | % [10] coro 2 r8 a a gis 4 e 8 gis fis ~ | fis 8 r r4 r2 | r8 a a gis 4 e 8 gis fis ( ~ | fis 4. gis 8 ~ gis 2 ) | r8 a a a b cis' d' d' ~ | d' 8 cis' b cis' 4 ( b 8 a a ) | r8 e e e e e e e ~ | e 1 | R1 | % [11] coro 3 r8 a a gis 4 e 8 gis fis ~ | fis 8 r r4 r2 | r8 a a gis 4 e 8 gis fis ( ~ | fis 4. gis 8 ~ gis 2 ) | r8 a a a b cis' d' d' ~ | d' 8 cis' b cis' 4 ( b 8 a a ) | r8 e e e e e e e ~ | % [12] finale e 1 | r8 e e e e e e e ~ | e 1 | r8 a a a b cis' b a ~ | a 1 | r8 a a a b cis' b a ( ~ | a 1 ~ | a 1 | b 1 ) | R1 | \bar "|." } % Voice \lyricsto "voz-tenor2" { % [1] intro % [2] estrofa 1 "Por" "un" "tiem" -- "po" "fuis" -- "te a" -- "zo" -- "te" "de" "cris" -- "tia" -- "nos;" "quién" "po" -- "drí" -- "a i" -- "ma" -- "gi" -- "nar" "que" "mien" -- "tras" "per" -- "se" -- "guí" -- "as" "her" -- "ma" -- "nos" "tu" "vi" -- "da en" "un" "ins" -- "tan" -- "te" "cam" -- "bió." % [3] estrofa 2 "Ah" "ah" "ah" "ah" "ah" "ah" "ah" "ah" "ah" "uh," "ah" "ah" "ah" "ah" "ah" "ah" "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios." % [4] puente 1 "Y" "pre" -- "di" -- "car" "por" "el" "mun" -- "do" "el" "nom" -- "bre" "de" "Je" -- "sús" "pa" -- "ra" "que" "to" -- "dos" "co" -- "noz" -- "can" "su" "sal" -- "va" -- "ción." % [5] coro 1 "Des" -- "ti" -- "na" -- "do a" "lle" -- "var" "la" "pa" -- "la" -- "bra" "de" "Dios," __ "San" "Pa" -- "blo, en" -- "sé" -- "ña" -- "me a" "ser" "co" -- "mo" "tú," __ "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios." % [6] interludio % [7] estrofa 3 "En" "tus" "car" -- "tas" "nos" "de" -- "jas" -- "te" "la en" -- "se" -- "ñan" -- "za" "de" "vi" -- "vir" "con" "hu" -- "mil" -- "dad," "de" "ser" "va" -- "lien" -- "tes" "en" "las" "ad" -- "ver" -- "si" -- "da" -- "des," "y en" "Cris" -- "to" "nues" -- "tra" "fe" "re" -- "no" -- "var." % [8] estrofa 4 "Ah" "ah" "ah" "ah" "ah" "ah" "ah" "ah" "ah" "oh" "ah" "ah" "ah" "ah" "ah" "ah" "ser" "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios." % [9] puente 2 "Y" "cuan" -- "do" "lle" -- "gue" "la" "du" -- "da," "el" "te" -- "mor" "o" "la a" -- "flic" -- "ción," "a" -- "mi" -- "go" "San" "Pa" -- "blo," "rue" -- "ga" "por" "mí." % [10] coro 2 "Des" -- "ti" -- "na" -- "do a" "lle" -- "var" "la" "pa" -- "la" -- "bra" "de" "Dios," __ "San" "Pa" -- "blo, en" -- "sé" -- "ña" -- "me a" "ser" "co" -- "mo" "tú," __ "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios." % [11] coro 3 "Des" -- "ti" -- "na" -- "do a" "lle" -- "var" "la" "pa" -- "la" -- "bra" "de" "Dios," __ "San" "Pa" -- "blo, en" -- "sé" -- "ña" -- "me a" "ser" "co" -- "mo" "tú," __ "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios," % [12] finale "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios," "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios," "un" "mi" -- "sio" -- "ne" -- "ro" "de" "Dios." __ } % Lyrics >> % Staff
[ "yosoy@danieldiaz.org" ]
yosoy@danieldiaz.org
484e433c88294e31f6125fe5157831095b3d6c57
e676ab46f8d641ce314ff68394c6c45bca3a9674
/第7章 输入输出流/7.1_有一元二次方程,当此公式出错,用cerr流输出有关信息.cpp
6fd1f8dc9de0500c40589d8e7d241ee32e8e059b
[]
no_license
dairycode/Cplusplus-language
0ac04edbed52cff20eb1e3c678c963c984e9f7bd
29cf9a0f3bd1f03d9e35f17bf34f35be2f3f09d7
refs/heads/master
2020-07-03T11:24:09.551988
2019-07-31T17:12:04
2019-07-31T17:12:04
201,891,062
0
0
null
null
null
null
UTF-8
C++
false
false
373
cpp
#include <iostream> #include <cmath> using namespace std; int main() { float a,b,c,disc; cout<<"please input a,b,c:"; cin>>a>>b>>c; if(a==0) cerr<<"a is equal to zero,error!"<<endl; else if((disc=b*b-4*a*c)<0) cerr<<"disc=b*b-4*a*c<0"<<endl; else { cout<<"x1="<<(-b+sqrt(disc))/(2*a)<<endl; cout<<"x2="<<(-b-sqrt(disc))/(2*a)<<endl; } return 0; }
[ "liuzeyes@126.com" ]
liuzeyes@126.com
68e58a30b866e25efa665e616ed6cc39e2cf2c36
90ab0be83a4e38ca7c9daec218d171e5fbcbd3a1
/untitled/Cliente.h
fad3bf570acd6d6897a5cda87510248fc28cf66a
[]
no_license
ThunderGer23/Curso-C-
d24d7c69ffd24d9036b573c886cd9f926923ffc8
59af2183730be0050e1cf85bae1a4d0ded923874
refs/heads/master
2022-12-09T23:24:06.928307
2020-09-12T05:52:54
2020-09-12T05:52:54
294,879,438
0
0
null
null
null
null
UTF-8
C++
false
false
631
h
// // Created by cuand on 16/8/2020. // #ifndef UNTITLED_CLIENTE_H #define UNTITLED_CLIENTE_H #include "Persona.h" class Cliente: public Persona { private: string calle; int num_int; int num_ext; string Ciudad; string contra; public: Cliente(string, string, string, string, string,string, int, int, string, string); string getCalle(); void setCalle(string ); int getNumInt(); void setNumInt(int ); int getNumExt(); void setNumExt(int ); string getCiudad(); void setCiudad(string ); string getContra(); void setContra(string _contra); }; #endif //UNTITLED_CLIENTE_H
[ "66645071+ThunderGer23@users.noreply.github.com" ]
66645071+ThunderGer23@users.noreply.github.com
4fe90a43651c08eb7de21d0b3e373edd24186dca
872f24199d847f05ddb4d8f7ac69eaed9336a0d5
/code/msvis/MSVis/CalibratingVi2FactoryI.cc
42713473ac3222da6af02852805cde88a9ceb17b
[]
no_license
schiebel/casa
8004f7d63ca037b4579af8a8bbfb4fa08e87ced4
e2ced7349036d8fc13d0a65aad9a77b76bfe55d1
refs/heads/master
2016-09-05T16:20:59.022063
2015-08-26T18:46:26
2015-08-26T18:46:26
41,441,084
1
1
null
null
null
null
UTF-8
C++
false
false
2,624
cc
//# CalibratingVi2FactoryI.cc: Implementation of the CalibratingVi2FactoryI class. //# //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. //# Copyright (C) European Southern Observatory, 2011, All rights reserved. //# //# This library is free software; you can redistribute it and/or //# modify it under the terms of the GNU Lesser General Public //# License as published by the Free software Foundation; either //# version 2.1 of the License, or (at your option) any later version. //# //# This library 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. See the GNU //# Lesser General Public License for more details. //# //# You should have received a copy of the GNU Lesser General Public //# License along with this library; if not, write to the Free Software //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, //# MA 02111-1307 USA //# $Id: $ #include <msvis/MSVis/CalibratingVi2FactoryI.h> #include <casa/Exceptions.h> namespace casa { //# NAMESPACE CASA - BEGIN namespace vi { //# NAMESPACE VI - BEGIN CalibratingVi2FactoryI::CalViFacGenerator CalibratingVi2FactoryI::generator_p=0; CalibratingVi2FactoryI::CalViFac_byRec_Generator CalibratingVi2FactoryI::byRec_generator_p=0; // ----------------------------------------------------------------------- CalibratingVi2FactoryI* CalibratingVi2FactoryI::generate() { ThrowIf (generator_p==0, "No CalibratingVi2FactoryI::generator (generic) available!"); //cout << "CVFI::generate()" << endl; return generator_p(); } // ----------------------------------------------------------------------- CalibratingVi2FactoryI* CalibratingVi2FactoryI::generate(MeasurementSet* ms, const Record& calrec, const IteratingParameters& iterpar) { ThrowIf (byRec_generator_p==0, "No CalibratingVi2FactoryI::generator (by Record) available!"); //cout << "CVFI::generate(ms,calrec,iterpar)" << endl; return byRec_generator_p(ms,calrec,iterpar); } // ----------------------------------------------------------------------- Bool CalibratingVi2FactoryI::setGenerator(CalViFacGenerator cvfg) { generator_p=cvfg; return True; } // ----------------------------------------------------------------------- Bool CalibratingVi2FactoryI::set_byRec_Generator(CalViFac_byRec_Generator cvfg) { byRec_generator_p=cvfg; return True; } } //# NAMESPACE VI - END } //# NAMESPACE CASA - END
[ "darrell@schiebel.us" ]
darrell@schiebel.us
ce0023c18f6d1a99b4e102288896449a28ebc6bd
35b943da1d426de3dd8331058b9d8e15e0ff3e9c
/Lab3_Task_3_6/Lab3_Task_3_6/main.cpp
99078e5ca2cbae6369a9e7d2f4c6b83af51eda0c
[]
no_license
arunjayabalan/SystemC
d40de288d3b7bdb888341c18e62e5a908f46dbac
737398db6da23cf740915f64cab41db2f91446f4
refs/heads/master
2016-08-12T03:33:53.265962
2015-12-10T16:34:37
2015-12-10T16:34:37
45,541,499
1
0
null
null
null
null
UTF-8
C++
false
false
511
cpp
#define _CRT_SECURE_NO_WARNINGS #define SC_INCLUDE_DYNAMIC_PROCESSES #include "systemc.h" //#include "Top.h" using namespace sc_core; using namespace sc_dt; using namespace std; #include "Initiator.h" #include "target.h" // Target module representing a simple memory int sc_main(int argc, char* argv[]) { Initiator *initiator; Memory *memory; //Top T("top"); initiator = new Initiator("initiator"); memory = new Memory("memory",1024); initiator->socket.bind(memory->socket); sc_start(); return 0; }
[ "arun.jayabalan@gmail.com" ]
arun.jayabalan@gmail.com
7cec000dcf17fee906d49826c76d1dc00bb2e98a
8dc84558f0058d90dfc4955e905dab1b22d12c08
/chrome/test/base/web_ui_browser_test_browsertest.cc
f424d7cd160732352d13b46fb479d83f90eb0bef
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
C++
false
false
9,785
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 <string> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/macros.h" #include "base/values.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/web_ui_browser_test.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_message_handler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest-spi.h" using content::WebUIMessageHandler; // According to the interface for EXPECT_FATAL_FAILURE // (https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#catching-failures) // the statement must be statically available. Therefore, we make a static // global s_test_ which should point to |this| for the duration of the test run // and be cleared afterward. class WebUIBrowserExpectFailTest : public WebUIBrowserTest { public: WebUIBrowserExpectFailTest() { EXPECT_FALSE(s_test_); s_test_ = this; } protected: ~WebUIBrowserExpectFailTest() override { EXPECT_TRUE(s_test_); s_test_ = NULL; } static void RunJavascriptTestNoReturn(const std::string& testname) { EXPECT_TRUE(s_test_); s_test_->RunJavascriptTest(testname); } static void RunJavascriptAsyncTestNoReturn(const std::string& testname) { EXPECT_TRUE(s_test_); s_test_->RunJavascriptAsyncTest(testname); } private: static WebUIBrowserTest* s_test_; }; WebUIBrowserTest* WebUIBrowserExpectFailTest::s_test_ = NULL; // Test that bogus javascript fails fast - no timeout waiting for result. IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestFailsFast) { AddLibrary(base::FilePath(FILE_PATH_LITERAL("sample_downloads.js"))); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("DISABLED_BogusFunctionName"), "WebUITestHandler::JavaScriptComplete"); } // Test that bogus javascript fails fast - no timeout waiting for result. IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestRuntimeErrorFailsFast) { AddLibrary(base::FilePath(FILE_PATH_LITERAL("runtime_error.js"))); ui_test_utils::NavigateToURL(browser(), GURL(kDummyURL)); EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("TestRuntimeErrorFailsFast"), "WebUITestHandler::JavaScriptComplete"); } // Test that bogus javascript fails async test fast as well - no timeout waiting // for result. IN_PROC_BROWSER_TEST_F(WebUIBrowserExpectFailTest, TestFailsAsyncFast) { AddLibrary(base::FilePath(FILE_PATH_LITERAL("sample_downloads.js"))); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); EXPECT_FATAL_FAILURE( RunJavascriptAsyncTestNoReturn("DISABLED_BogusFunctionName"), "WebUITestHandler::JavaScriptComplete"); } // Tests that the async framework works. class WebUIBrowserAsyncTest : public WebUIBrowserTest { public: // Calls the testDone() function from test_api.js void TestDone() { RunJavascriptFunction("testDone"); } // Starts a failing test. void RunTestFailsAssert() { RunJavascriptFunction("runAsync", base::Value("testFailsAssert")); } // Starts a passing test. void RunTestPasses() { RunJavascriptFunction("runAsync", base::Value("testPasses")); } protected: WebUIBrowserAsyncTest() {} // Class to synchronize asynchronous javascript activity with the tests. class AsyncWebUIMessageHandler : public WebUIMessageHandler { public: AsyncWebUIMessageHandler() {} MOCK_METHOD1(HandleTestContinues, void(const base::ListValue*)); MOCK_METHOD1(HandleTestFails, void(const base::ListValue*)); MOCK_METHOD1(HandleTestPasses, void(const base::ListValue*)); private: void RegisterMessages() override { web_ui()->RegisterMessageCallback( "startAsyncTest", base::BindRepeating(&AsyncWebUIMessageHandler::HandleStartAsyncTest, base::Unretained(this))); web_ui()->RegisterMessageCallback( "testContinues", base::BindRepeating(&AsyncWebUIMessageHandler::HandleTestContinues, base::Unretained(this))); web_ui()->RegisterMessageCallback( "testFails", base::BindRepeating(&AsyncWebUIMessageHandler::HandleTestFails, base::Unretained(this))); web_ui()->RegisterMessageCallback( "testPasses", base::BindRepeating(&AsyncWebUIMessageHandler::HandleTestPasses, base::Unretained(this))); } // Starts the test in |list_value|[0] with the runAsync wrapper. void HandleStartAsyncTest(const base::ListValue* list_value) { const base::Value* test_name; ASSERT_TRUE(list_value->Get(0, &test_name)); web_ui()->CallJavascriptFunctionUnsafe("runAsync", *test_name); } DISALLOW_COPY_AND_ASSIGN(AsyncWebUIMessageHandler); }; // Handler for this object. ::testing::StrictMock<AsyncWebUIMessageHandler> message_handler_; private: // Provide this object's handler. WebUIMessageHandler* GetMockMessageHandler() override { return &message_handler_; } // Set up and browse to kDummyURL for all tests. void SetUpOnMainThread() override { WebUIBrowserTest::SetUpOnMainThread(); AddLibrary(base::FilePath(FILE_PATH_LITERAL("async.js"))); ui_test_utils::NavigateToURL(browser(), GURL(kDummyURL)); } DISALLOW_COPY_AND_ASSIGN(WebUIBrowserAsyncTest); }; // Test that assertions fail immediately after assertion fails (no testContinues // message). (Sync version). IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestSyncOkTestFail) { ASSERT_FALSE(RunJavascriptTest("testFailsAssert")); } // Test that assertions fail immediately after assertion fails (no testContinues // message). (Async version). IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestAsyncFailsAssert) { EXPECT_CALL(message_handler_, HandleTestFails(::testing::_)); ASSERT_FALSE( RunJavascriptAsyncTest("startAsyncTest", base::Value("testFailsAssert"))); } // Test that expectations continue the function, but fail the test. IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestAsyncFailsExpect) { ::testing::InSequence s; EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); EXPECT_CALL(message_handler_, HandleTestFails(::testing::_)); ASSERT_FALSE( RunJavascriptAsyncTest("startAsyncTest", base::Value("testFailsExpect"))); } // Test that test continues and passes. (Sync version). IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestSyncPasses) { EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); ASSERT_TRUE(RunJavascriptTest("testPasses")); } // Test that test continues and passes. (Async version). IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestAsyncPasses) { ::testing::InSequence s; EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); EXPECT_CALL(message_handler_, HandleTestPasses(::testing::_)) .WillOnce(::testing::InvokeWithoutArgs( this, &WebUIBrowserAsyncTest::TestDone)); ASSERT_TRUE( RunJavascriptAsyncTest("startAsyncTest", base::Value("testPasses"))); } // Test that two tests pass. IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestAsyncPassPass) { ::testing::InSequence s; EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); EXPECT_CALL(message_handler_, HandleTestPasses(::testing::_)) .WillOnce(::testing::InvokeWithoutArgs( this, &WebUIBrowserAsyncTest::RunTestPasses)); EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); EXPECT_CALL(message_handler_, HandleTestPasses(::testing::_)) .WillOnce(::testing::InvokeWithoutArgs( this, &WebUIBrowserAsyncTest::TestDone)); ASSERT_TRUE( RunJavascriptAsyncTest("startAsyncTest", base::Value("testPasses"))); } // Test that first test passes; second fails. IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestAsyncPassThenFail) { ::testing::InSequence s; EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); EXPECT_CALL(message_handler_, HandleTestPasses(::testing::_)) .WillOnce(::testing::InvokeWithoutArgs( this, &WebUIBrowserAsyncTest::RunTestFailsAssert)); EXPECT_CALL(message_handler_, HandleTestFails(::testing::_)); ASSERT_FALSE( RunJavascriptAsyncTest("startAsyncTest", base::Value("testPasses"))); } // Test that testDone() with failure first then sync pass still fails. IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestAsyncDoneFailFirstSyncPass) { ::testing::InSequence s; EXPECT_CALL(message_handler_, HandleTestContinues(::testing::_)); EXPECT_CALL(message_handler_, HandleTestFails(::testing::_)); // Call runAsync directly instead of deferring through startAsyncTest. It will // call testDone() on failure, then return. ASSERT_FALSE(RunJavascriptAsyncTest( "runAsync", base::Value("testAsyncDoneFailFirstSyncPass"))); } // Test that calling testDone during RunJavascriptAsyncTest still completes // when waiting for async result. This is similar to the previous test, but call // testDone directly and expect pass result. IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPassesAsync) { ASSERT_TRUE(RunJavascriptAsyncTest("testDone")); } // Test that calling testDone during RunJavascriptTest still completes when // waiting for async result. IN_PROC_BROWSER_TEST_F(WebUIBrowserAsyncTest, TestTestDoneEarlyPasses) { ASSERT_TRUE(RunJavascriptTest("testDone")); }
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
93f683b109d0f2276466cc6ceef4335c328caefe
d8feb1a340b579c303e9ac17554addd142acb374
/drip/Drip.h
4becf90066d492fc17a9535f0855ba84068c3f0e
[]
no_license
mayd/more_opengl_demos
0ff990c78c3176daff7fb40a9a10a14b049c3061
b384e41f7d21604c8c6fe9f5e48cdccece47fc3b
refs/heads/master
2023-03-31T02:26:17.117192
2021-03-29T14:05:05
2021-03-29T14:05:05
351,795,343
0
0
null
null
null
null
UTF-8
C++
false
false
2,711
h
/* * (c) Copyright 1993, 1994, 1995, 1996 Silicon Graphics, Inc. * ALL RIGHTS RESERVED * Permission to use, copy, modify, and distribute this software for * any purpose and without fee is hereby granted, provided that the above * copyright notice appear in all copies and that both the copyright notice * and this permission notice appear in supporting documentation, and that * the name of Silicon Graphics, Inc. not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. * * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. * * US Government Users Restricted Rights * Use, duplication, or disclosure by the Government is subject to * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph * (c)(1)(ii) of the Rights in Technical Data and Computer Software * clause at DFARS 252.227-7013 and/or in similar or successor * clauses in the FAR or the DOD or NASA FAR Supplement. * Unpublished-- rights reserved under the copyright laws of the * United States. Contractor/manufacturer is Silicon Graphics, * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. * * OpenGL(TM) is a trademark of Silicon Graphics, Inc. */ #ifndef DRIP_H #define DRIP_H class Drip { public: Drip(); ~Drip(); void draw(); void draw_starburst(); void set_divisions(int new_divisions); int get_divisions(); /* If one has a whole lot of drips, it is more efficient for all * drips to share a list a points. * All drips sharing a list must have the same number of divisions. */ void set_points(float *new_points); /* Allocate points to hold the right number of numbers */ void alloc_points(); /* Fill the points with the appropriate sin and cos values */ void fill_points(); float *get_points(); float outer_color[4], ring_color[4], inner_color[4]; float outer_radius, ring_radius; private: int divisions; float *points; }; #endif
[ "MAYDAVIDR@GMAIL.COM" ]
MAYDAVIDR@GMAIL.COM
a00a60ec6cae93797514317b40c129aefc2f5319
27d319a8c9c41176e342911f38c9379dac819e33
/src/qt/huntcoinunits.h
458672fa24802bc6d36da26915238a022115de39
[ "MIT" ]
permissive
HuntCoinDeveloper/huntcoin
6ec86d4904313408ad4a3e7721e01c650eab048e
99198152d21b58ce598f46783074b64113cc5e64
refs/heads/master
2020-05-18T18:00:54.723915
2019-05-17T15:09:06
2019-05-17T15:09:06
184,568,978
2
0
null
null
null
null
UTF-8
C++
false
false
4,067
h
// Copyright (c) 2011-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef HUNTCOIN_QT_HUNTCOINUNITS_H #define HUNTCOIN_QT_HUNTCOINUNITS_H #include <amount.h> #include <QAbstractListModel> #include <QString> // U+2009 THIN SPACE = UTF-8 E2 80 89 #define REAL_THIN_SP_CP 0x2009 #define REAL_THIN_SP_UTF8 "\xE2\x80\x89" #define REAL_THIN_SP_HTML "&thinsp;" // U+200A HAIR SPACE = UTF-8 E2 80 8A #define HAIR_SP_CP 0x200A #define HAIR_SP_UTF8 "\xE2\x80\x8A" #define HAIR_SP_HTML "&#8202;" // U+2006 SIX-PER-EM SPACE = UTF-8 E2 80 86 #define SIXPEREM_SP_CP 0x2006 #define SIXPEREM_SP_UTF8 "\xE2\x80\x86" #define SIXPEREM_SP_HTML "&#8198;" // U+2007 FIGURE SPACE = UTF-8 E2 80 87 #define FIGURE_SP_CP 0x2007 #define FIGURE_SP_UTF8 "\xE2\x80\x87" #define FIGURE_SP_HTML "&#8199;" // QMessageBox seems to have a bug whereby it doesn't display thin/hair spaces // correctly. Workaround is to display a space in a small font. If you // change this, please test that it doesn't cause the parent span to start // wrapping. #define HTML_HACK_SP "<span style='white-space: nowrap; font-size: 6pt'> </span>" // Define THIN_SP_* variables to be our preferred type of thin space #define THIN_SP_CP REAL_THIN_SP_CP #define THIN_SP_UTF8 REAL_THIN_SP_UTF8 #define THIN_SP_HTML HTML_HACK_SP /** Huntcoin unit definitions. Encapsulates parsing and formatting and serves as list model for drop-down selection boxes. */ class HuntcoinUnits: public QAbstractListModel { Q_OBJECT public: explicit HuntcoinUnits(QObject *parent); /** Huntcoin units. @note Source: https://en.huntcoin.it/wiki/Units . Please add only sensible ones */ enum Unit { BTC, mBTC, uBTC }; enum SeparatorStyle { separatorNever, separatorStandard, separatorAlways }; //! @name Static API //! Unit conversion and formatting ///@{ //! Get list of units, for drop-down box static QList<Unit> availableUnits(); //! Is unit ID valid? static bool valid(int unit); //! Long name static QString longName(int unit); //! Short name static QString shortName(int unit); //! Longer description static QString description(int unit); //! Number of Satoshis (1e-8) per unit static qint64 factor(int unit); //! Number of decimals left static int decimals(int unit); //! Format as string static QString format(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard); //! Format as string (with unit) static QString formatWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard); //! Format as HTML string (with unit) static QString formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard); //! Parse string to coin amount static bool parse(int unit, const QString &value, CAmount *val_out); //! Gets title for amount column including current display unit if optionsModel reference available */ static QString getAmountColumnTitle(int unit); ///@} //! @name AbstractListModel implementation //! List model for unit drop-down selection box. ///@{ enum RoleIndex { /** Unit identifier */ UnitRole = Qt::UserRole }; int rowCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; ///@} static QString removeSpaces(QString text) { text.remove(' '); text.remove(QChar(THIN_SP_CP)); #if (THIN_SP_CP != REAL_THIN_SP_CP) text.remove(QChar(REAL_THIN_SP_CP)); #endif return text; } //! Return maximum number of base units (Satoshis) static CAmount maxMoney(); private: QList<HuntcoinUnits::Unit> unitlist; }; typedef HuntcoinUnits::Unit HuntcoinUnit; #endif // HUNTCOIN_QT_HUNTCOINUNITS_H
[ "github@huntcoin.africa" ]
github@huntcoin.africa
63027ed13bea2b9858c75ca48941bca5ddd18090
5ffa94d821a79d6af4c581d1b48aeaeded819e0f
/C++/14.最长公共前缀.cpp
b84e600785581be0cec96cd08bf8f075a3a0894d
[]
no_license
YueNing/LC-learning
a4fd1fbed43a5825ae42c579d09836f0b4ee22ad
73c64fb8b17b47d5cffb05131ef85b8969a8f488
refs/heads/master
2021-07-09T21:21:06.540502
2021-02-27T03:08:15
2021-02-27T03:08:15
228,195,914
2
2
null
2020-01-12T17:32:47
2019-12-15T14:17:17
C++
UTF-8
C++
false
false
810
cpp
/* * @lc app=leetcode.cn id=14 lang=cpp * * [14] 最长公共前缀 */ // @lc code=start class Solution { public: string longestCommonPrefix(vector<string>& strs) { int sizeOfStrs = strs.size(); if (sizeOfStrs == 1) { return strs[0]; } int size = INT_MAX; string res; for (string str : strs) { int tmp = str.size(); size = min(size, tmp); } for (int i = 0; i < size; i++) { for (int j = 0; j < sizeOfStrs - 1; j++) { if (strs[j][i] != strs[j + 1][i]) { return res; } if (j == sizeOfStrs - 2) { res += strs[j][i]; } } } return res; } }; // @lc code=end
[ "zjuxmh@gmail.com" ]
zjuxmh@gmail.com
a21434837692397d2bc9d7a14d15e286acf944fe
ef142ad790366ca1f65da6a0d82583ce8757dd1c
/blitzd/plugins/bnet/OldAccountChange.h
fae0646f06e83fde73065e0b55699cfd73e0697d
[ "MIT" ]
permissive
shellohunter/blitzd
1242a8794346d67099769c9993ff4ba92dac2792
774a543b619d3332dd40e9cde32aa54948145cb4
refs/heads/master
2021-05-26T14:43:19.775032
2012-12-26T06:01:03
2012-12-26T06:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
213
h
#ifndef _OLDACCOUNTCHANGE_H_ #define _OLDACCOUNTCHANGE_H_ #include "interface/IPlugin.h" namespace Plugins { namespace BNet { DECLARE_TCP_PLUGIN(OldAccountChange, 0x31FF) } } #endif // _OLDACCOUNTCHANGE_H_
[ "soarchin@gmail.com" ]
soarchin@gmail.com
4db270834d449889371e806baa18cfa1987a332b
cbf650bab1cf76df30af95949d9dc89b72a0259e
/Project1/RBTree - 副本.hpp
51c8dff04cf49242087da6b4809000f664c84ab9
[]
no_license
yuew016/rising-city
df53c46a3cb3f6aa520a9d7ac85f92bf220e11f6
6f99e5f67693c0d25b96a86856ef9364c034e6d0
refs/heads/master
2022-06-17T09:51:09.497696
2020-05-11T05:13:58
2020-05-11T05:13:58
null
0
0
null
null
null
null
GB18030
C++
false
false
19,574
hpp
#pragma once #ifndef _RED_BLACK_TREE_HPP_ #define _RED_BLACK_TREE_HPP_ #include <iomanip> #include <iostream> #include"MinHeap.hpp" using namespace std; enum RBTColor { RED, BLACK }; class RBTNode { public: RBTColor color; // 颜色 int buildingNum; // 关键字(键值) 建筑编号 RBTNode* left; // 左孩子 RBTNode* right; // 右孩子 RBTNode* parent; // 父结点 int executed_time; //已建时间 int total_time; //总耗时 RBTNode(int value, int et, int tt, RBTColor c, RBTNode* p, RBTNode* l, RBTNode* r) : buildingNum(value), executed_time(et), total_time(tt), color(c), parent(), left(l), right(r){} }; class RBTree { private: RBTNode* mRoot; // 根结点 public: RBTree(); ~RBTree(); // 前序遍历"红黑树" void preOrder(); // 中序遍历"红黑树" void inOrder(); // 后序遍历"红黑树" void postOrder(); // (递归实现)查找"红黑树"中键值为buildingNum的节点 RBTNode* search(int buildingNum); // (非递归实现)查找"红黑树"中键值为buildingNum的节点 RBTNode* iterativeSearch(int buildingNum); // 查找最小结点:返回最小结点的键值。 int minimum(); // 查找最大结点:返回最大结点的键值。 int maximum(); // 找结点(x)的后继结点。即,查找"红黑树中数据值大于该结点"的"最小结点"。 RBTNode* successor(RBTNode* x); // 找结点(x)的前驱结点。即,查找"红黑树中数据值小于该结点"的"最大结点"。 RBTNode* predecessor(RBTNode* x); // 将结点(buildingNum为节点键值)插入到红黑树中 void insert(int buildingNum, int executed_time, int total_time); // 删除结点(buildingNum为节点键值) void remove(int buildingNum); // 销毁红黑树 void destroy(); // 打印红黑树 void print(); private: // 前序遍历"红黑树" void preOrder(RBTNode* tree) const; // 中序遍历"红黑树" void inOrder(RBTNode* tree) const; // 后序遍历"红黑树" void postOrder(RBTNode* tree) const; // (递归实现)查找"红黑树x"中键值为buildingNum的节点 RBTNode* search(RBTNode* x, int buildingNum) const; // (非递归实现)查找"红黑树x"中键值为buildingNum的节点 RBTNode* iterativeSearch(RBTNode* x, int buildingNum) const; // 查找最小结点:返回tree为根结点的红黑树的最小结点。 RBTNode* minimum(RBTNode* tree); // 查找最大结点:返回tree为根结点的红黑树的最大结点。 RBTNode* maximum(RBTNode* tree); // 左旋 void leftRotate(RBTNode*& root, RBTNode* x); // 右旋 void rightRotate(RBTNode*& root, RBTNode* y); // 插入函数 void insert(RBTNode*& root, RBTNode* node); // 插入修正函数 void insertFixUp(RBTNode*& root, RBTNode* node); // 删除函数 void remove(RBTNode*& root, RBTNode* node); // 删除修正函数 void removeFixUp(RBTNode*& root, RBTNode* node, RBTNode* parent); // 销毁红黑树 void destroy(RBTNode*& tree); // 打印红黑树 void print(RBTNode* tree, int buildingNum, int direction); #define rb_parent(r) ((r)->parent) #define rb_color(r) ((r)->color) #define rb_is_red(r) ((r)->color==RED) #define rb_is_black(r) ((r)->color==BLACK) #define rb_set_black(r) do { (r)->color = BLACK; } while (0) #define rb_set_red(r) do { (r)->color = RED; } while (0) #define rb_set_parent(r,p) do { (r)->parent = (p); } while (0) #define rb_set_color(r,c) do { (r)->color = (c); } while (0) }; /* * 构造函数 */ RBTree::RBTree() :mRoot(NULL) { mRoot = NULL; } /* * 析构函数 */ RBTree::~RBTree() { destroy(); } /* * 前序遍历"红黑树" */ void RBTree::preOrder(RBTNode* tree) const { if (tree != NULL) { cout << "(" << tree->buildingNum << "," << tree->executed_time << "," << tree->total_time << ") "; preOrder(tree->left); preOrder(tree->right); } } void RBTree::preOrder() { preOrder(mRoot); } /* * 中序遍历"红黑树" */ void RBTree::inOrder(RBTNode* tree) const { if (tree != NULL) { inOrder(tree->left); cout << "(" << tree->buildingNum << "," << tree->executed_time << "," << tree->total_time << ") "; inOrder(tree->right); } } void RBTree::inOrder() { inOrder(mRoot); } /* * 后序遍历"红黑树" */ void RBTree::postOrder(RBTNode* tree) const { if (tree != NULL) { postOrder(tree->left); postOrder(tree->right); cout << "(" << tree->buildingNum << "," << tree->executed_time << "," << tree->total_time << ") "; } } void RBTree::postOrder() { postOrder(mRoot); } /* * (递归实现)查找"红黑树x"中键值为buildingNum的节点 */ RBTNode* RBTree::search(RBTNode* x, int buildingNum) const { if (x == NULL || x->buildingNum == buildingNum) return x; if (buildingNum < x->buildingNum) return search(x->left, buildingNum); else return search(x->right, buildingNum); } RBTNode* RBTree::search(int buildingNum) { search(mRoot, buildingNum); } /* * (非递归实现)查找"红黑树x"中键值为buildingNum的节点 */ RBTNode* RBTree::iterativeSearch(RBTNode* x, int buildingNum) const { while ((x != NULL) && (x->buildingNum != buildingNum)) { if (buildingNum < x->buildingNum) x = x->left; else x = x->right; } return x; } RBTNode* RBTree::iterativeSearch(int buildingNum) { iterativeSearch(mRoot, buildingNum); } /* * 查找最小结点:返回tree为根结点的红黑树的最小结点。 */ RBTNode* RBTree::minimum(RBTNode* tree) { if (tree == NULL) return NULL; while (tree->left != NULL) tree = tree->left; return tree; } int RBTree::minimum() { RBTNode* p = minimum(mRoot); if (p != NULL) return p->buildingNum; return (int)NULL; } /* * 查找最大结点:返回tree为根结点的红黑树的最大结点。 */ RBTNode* RBTree::maximum(RBTNode* tree) { if (tree == NULL) return NULL; while (tree->right != NULL) tree = tree->right; return tree; } int RBTree::maximum() { RBTNode* p = maximum(mRoot); if (p != NULL) return p->buildingNum; return (int)NULL; } /* * 找结点(x)的后继结点。即,查找"红黑树中数据值大于该结点"的"最小结点"。 */ RBTNode* RBTree::successor(RBTNode* x) { // 如果x存在右孩子,则"x的后继结点"为 "以其右孩子为根的子树的最小结点"。 if (x->right != NULL) return minimum(x->right); // 如果x没有右孩子。则x有以下两种可能: // (01) x是"一个左孩子",则"x的后继结点"为 "它的父结点"。 // (02) x是"一个右孩子",则查找"x的最低的父结点,并且该父结点要具有左孩子",找到的这个"最低的父结点"就是"x的后继结点"。 RBTNode* y = x->parent; while ((y != NULL) && (x == y->right)) { x = y; y = y->parent; } return y; } /* * 找结点(x)的前驱结点。即,查找"红黑树中数据值小于该结点"的"最大结点"。 */ RBTNode* RBTree::predecessor(RBTNode* x) { // 如果x存在左孩子,则"x的前驱结点"为 "以其左孩子为根的子树的最大结点"。 if (x->left != NULL) return maximum(x->left); // 如果x没有左孩子。则x有以下两种可能: // (01) x是"一个右孩子",则"x的前驱结点"为 "它的父结点"。 // (01) x是"一个左孩子",则查找"x的最低的父结点,并且该父结点要具有右孩子",找到的这个"最低的父结点"就是"x的前驱结点"。 RBTNode* y = x->parent; while ((y != NULL) && (x == y->left)) { x = y; y = y->parent; } return y; } /* * 对红黑树的节点(x)进行左旋转 * * 左旋示意图(对节点x进行左旋): * px px * / / * x y * / \ --(左旋)--> / \ # * lx y x ry * / \ / \ * ly ry lx ly * * */ void RBTree::leftRotate(RBTNode*& root, RBTNode* x) { // 设置x的右孩子为y RBTNode* y = x->right; // 将 “y的左孩子” 设为 “x的右孩子”; // 如果y的左孩子非空,将 “x” 设为 “y的左孩子的父亲” x->right = y->left; if (y->left != NULL) y->left->parent = x; // 将 “x的父亲” 设为 “y的父亲” y->parent = x->parent; if (x->parent == NULL) { root = y; // 如果 “x的父亲” 是空节点,则将y设为根节点 } else { if (x->parent->left == x) x->parent->left = y; // 如果 x是它父节点的左孩子,则将y设为“x的父节点的左孩子” else x->parent->right = y; // 如果 x是它父节点的右孩子,则将y设为“x的父节点的右孩子” } // 将 “x” 设为 “y的左孩子” y->left = x; // 将 “x的父节点” 设为 “y” x->parent = y; } /* * 对红黑树的节点(y)进行右旋转 * * 右旋示意图(对节点y进行左旋): * py py * / / * y x * / \ --(右旋)--> / \ # * x ry lx y * / \ / \ # * lx rx rx ry * */ void RBTree::rightRotate(RBTNode*& root, RBTNode* y) { // 设置x是当前节点的左孩子。 RBTNode* x = y->left; // 将 “x的右孩子” 设为 “y的左孩子”; // 如果"x的右孩子"不为空的话,将 “y” 设为 “x的右孩子的父亲” y->left = x->right; if (x->right != NULL) x->right->parent = y; // 将 “y的父亲” 设为 “x的父亲” x->parent = y->parent; if (y->parent == NULL) { root = x; // 如果 “y的父亲” 是空节点,则将x设为根节点 } else { if (y == y->parent->right) y->parent->right = x; // 如果 y是它父节点的右孩子,则将x设为“y的父节点的右孩子” else y->parent->left = x; // (y是它父节点的左孩子) 将x设为“x的父节点的左孩子” } // 将 “y” 设为 “x的右孩子” x->right = y; // 将 “y的父节点” 设为 “x” y->parent = x; } /* * 红黑树插入修正函数 * * 在向红黑树中插入节点之后(失去平衡),再调用该函数; * 目的是将它重新塑造成一颗红黑树。 * * 参数说明: * root 红黑树的根 * node 插入的结点 // 对应《算法导论》中的z */ void RBTree::insertFixUp(RBTNode*& root, RBTNode* node) { RBTNode* parent, * gparent; // 若“父节点存在,并且父节点的颜色是红色” while ((parent = rb_parent(node)) && rb_is_red(parent)) { gparent = rb_parent(parent); //若“父节点”是“祖父节点的左孩子” if (parent == gparent->left) { // Case 1条件:叔叔节点是红色 { RBTNode* uncle = gparent->right; if (uncle && rb_is_red(uncle)) { rb_set_black(uncle); rb_set_black(parent); rb_set_red(gparent); node = gparent; continue; } } // Case 2条件:叔叔是黑色,且当前节点是右孩子 if (parent->right == node) { RBTNode* tmp; leftRotate(root, parent); tmp = parent; parent = node; node = tmp; } // Case 3条件:叔叔是黑色,且当前节点是左孩子。 rb_set_black(parent); rb_set_red(gparent); rightRotate(root, gparent); } else//若“z的父节点”是“z的祖父节点的右孩子” { // Case 1条件:叔叔节点是红色 { RBTNode* uncle = gparent->left; if (uncle && rb_is_red(uncle)) { rb_set_black(uncle); rb_set_black(parent); rb_set_red(gparent); node = gparent; continue; } } // Case 2条件:叔叔是黑色,且当前节点是左孩子 if (parent->left == node) { RBTNode* tmp; rightRotate(root, parent); tmp = parent; parent = node; node = tmp; } // Case 3条件:叔叔是黑色,且当前节点是右孩子。 rb_set_black(parent); rb_set_red(gparent); leftRotate(root, gparent); } } // 将根节点设为黑色 rb_set_black(root); } /* * 将结点插入到红黑树中 * * 参数说明: * root 红黑树的根结点 * node 插入的结点 // 对应《算法导论》中的node */ void RBTree::insert(RBTNode*& root, RBTNode* node) { RBTNode* y = NULL; RBTNode* x = root; // 1. 将红黑树当作一颗二叉查找树,将节点添加到二叉查找树中。 while (x != NULL) { y = x; if (node->buildingNum < x->buildingNum) x = x->left; else x = x->right; } node->parent = y; if (y != NULL) { if (node->buildingNum < y->buildingNum) y->left = node; else y->right = node; } else root = node; //2. point to MinHeap // 3. 设置节点的颜色为红色 node->color = RED; // 3. 将它重新修正为一颗二叉查找树 insertFixUp(root, node); } /* * 将结点(buildingNum为节点键值)插入到红黑树中 * * 参数说明: * tree 红黑树的根结点 * buildingNum 插入结点的键值 */ void RBTree::insert(int buildingNum, int executed_time, int total_time) { RBTNode* z = NULL; // 如果新建结点失败,则返回。 if ((z = new RBTNode(buildingNum, executed_time, total_time, BLACK, NULL, NULL, NULL)) == NULL) return; insert(mRoot, z); } /* * 红黑树删除修正函数 * * 在从红黑树中删除插入节点之后(红黑树失去平衡),再调用该函数; * 目的是将它重新塑造成一颗红黑树。 * * 参数说明: * root 红黑树的根 * node 待修正的节点 */ void RBTree::removeFixUp(RBTNode*& root, RBTNode* node, RBTNode* parent) { RBTNode* other; while ((!node || rb_is_black(node)) && node != root) { if (parent->left == node) { other = parent->right; if (rb_is_red(other)) { // Case 1: x的兄弟w是红色的 rb_set_black(other); rb_set_red(parent); leftRotate(root, parent); other = parent->right; } if ((!other->left || rb_is_black(other->left)) && (!other->right || rb_is_black(other->right))) { // Case 2: x的兄弟w是黑色,且w的俩个孩子也都是黑色的 rb_set_red(other); node = parent; parent = rb_parent(node); } else { if (!other->right || rb_is_black(other->right)) { // Case 3: x的兄弟w是黑色的,并且w的左孩子是红色,右孩子为黑色。 rb_set_black(other->left); rb_set_red(other); rightRotate(root, other); other = parent->right; } // Case 4: x的兄弟w是黑色的;并且w的右孩子是红色的,左孩子任意颜色。 rb_set_color(other, rb_color(parent)); rb_set_black(parent); rb_set_black(other->right); leftRotate(root, parent); node = root; break; } } else { other = parent->left; if (rb_is_red(other)) { // Case 1: x的兄弟w是红色的 rb_set_black(other); rb_set_red(parent); rightRotate(root, parent); other = parent->left; } if ((!other->left || rb_is_black(other->left)) && (!other->right || rb_is_black(other->right))) { // Case 2: x的兄弟w是黑色,且w的俩个孩子也都是黑色的 rb_set_red(other); node = parent; parent = rb_parent(node); } else { if (!other->left || rb_is_black(other->left)) { // Case 3: x的兄弟w是黑色的,并且w的左孩子是红色,右孩子为黑色。 rb_set_black(other->right); rb_set_red(other); leftRotate(root, other); other = parent->left; } // Case 4: x的兄弟w是黑色的;并且w的右孩子是红色的,左孩子任意颜色。 rb_set_color(other, rb_color(parent)); rb_set_black(parent); rb_set_black(other->left); rightRotate(root, parent); node = root; break; } } } if (node) rb_set_black(node); } /* * 删除结点(node),并返回被删除的结点 * * 参数说明: * root 红黑树的根结点 * node 删除的结点 */ void RBTree::remove(RBTNode*& root, RBTNode* node) { RBTNode* child, * parent; RBTColor color; // 被删除节点的"左右孩子都不为空"的情况。 if ((node->left != NULL) && (node->right != NULL)) { // 被删节点的后继节点。(称为"取代节点") // 用它来取代"被删节点"的位置,然后再将"被删节点"去掉。 RBTNode* replace = node; // 获取后继节点 replace = replace->right; while (replace->left != NULL) replace = replace->left; // "node节点"不是根节点(只有根节点不存在父节点) if (rb_parent(node)) { if (rb_parent(node)->left == node) rb_parent(node)->left = replace; else rb_parent(node)->right = replace; } else // "node节点"是根节点,更新根节点。 root = replace; // child是"取代节点"的右孩子,也是需要"调整的节点"。 // "取代节点"肯定不存在左孩子!因为它是一个后继节点。 child = replace->right; parent = rb_parent(replace); // 保存"取代节点"的颜色 color = rb_color(replace); // "被删除节点"是"它的后继节点的父节点" if (parent == node) { parent = replace; } else { // child不为空 if (child) rb_set_parent(child, parent); parent->left = child; replace->right = node->right; rb_set_parent(node->right, replace); } replace->parent = node->parent; replace->color = node->color; replace->left = node->left; node->left->parent = replace; if (color == BLACK) removeFixUp(root, child, parent); delete node; return; } if (node->left != NULL) child = node->left; else child = node->right; parent = node->parent; // 保存"取代节点"的颜色 color = node->color; if (child) child->parent = parent; // "node节点"不是根节点 if (parent) { if (parent->left == node) parent->left = child; else parent->right = child; } else root = child; if (color == BLACK) removeFixUp(root, child, parent); delete node; } /* * 删除红黑树中键值为buildingNum的节点 * * 参数说明: * tree 红黑树的根结点 */ void RBTree::remove(int buildingNum) { RBTNode* node; // 查找buildingNum对应的节点(node),找到的话就删除该节点 if ((node = search(mRoot, buildingNum)) != NULL) remove(mRoot, node); } /* * 销毁红黑树 */ void RBTree::destroy(RBTNode*& tree) { if (tree == NULL) return; if (tree->left != NULL) return destroy(tree->left); if (tree->right != NULL) return destroy(tree->right); delete tree; tree = NULL; } void RBTree::destroy() { destroy(mRoot); } /* * 打印"二叉查找树" * * buildingNum -- 节点的键值 * direction -- 0,表示该节点是根节点; * -1,表示该节点是它的父结点的左孩子; * 1,表示该节点是它的父结点的右孩子。 */ void RBTree::print(RBTNode* tree, int buildingNum, int direction) { if (tree != NULL) { if (direction == 0) // tree是根节点 cout << setw(2) << tree->buildingNum << "(B) is root" << endl; else // tree是分支节点 cout << setw(2) << tree->buildingNum << (rb_is_red(tree) ? "(R)" : "(B)") << " is " << setw(2) << buildingNum << "'s " << setw(12) << (direction == 1 ? "right child" : "left child") << endl; print(tree->left, tree->buildingNum, -1); print(tree->right, tree->buildingNum, 1); } } void RBTree::print() { if (mRoot != NULL) print(mRoot, mRoot->buildingNum, 0); } #endif
[ "wangyue016@outlook.com" ]
wangyue016@outlook.com
1ec73d28e182d702b5bb43c832f6b17b1aeab1a5
5b30ddfa88ce17b2efafaabaf24c60f951152bd3
/[3]3.0下册案例/第13章 体育竞技游戏——火力篮球/FireBasketBall/jni/SQLiteUtil/SQLiteUtil.h
5a10bef9c173e00a0414979712d97486f7f9d894
[ "Zlib", "LicenseRef-scancode-unknown-license-reference" ]
permissive
liuxuanhai/Android_OpenGL_30Demo
bb3b53c69babf945fb34efbcfe198ed00fa37ec9
44af8fa7112bb65267c21fc295fcdc1cd019d63e
refs/heads/master
2020-05-19T19:25:57.430385
2019-01-24T14:28:31
2019-01-24T14:28:31
null
0
0
null
null
null
null
GB18030
C++
false
false
661
h
#ifndef _SQLiteUtil_H_ #define _SQLiteUtil_H_ using namespace std; #include "SQLiteUtil/sqlite3.h" using namespace std; #include <string> #include <vector> class SQLiteUtil { public: SQLiteUtil(); ~SQLiteUtil(){} //打开openSQLiteDB static bool open(); static void close(); static int doSqlite3_exec(std::string SQLSring); static int _sql_callback(void * notused, int argc, char ** argv, char ** szColName); static std::vector<std::string>* query(std::string sql); public: static char * pErrMsg; static sqlite3* pDB; //打开的编号 static int nRes; //查询结果储存的向量 static std::vector<std::string>* resultVector; }; #endif
[ "525647740@qq.com" ]
525647740@qq.com
6252e4805694afa6825ebb5d8860409e33983fc8
ec51cb2504d5bc88cf56c6083f9747e6f20ce4ba
/wifi.h
00eb75dd2e649c48adaf772cd1c8628bc919c16d
[]
no_license
ichigovishal/WashingMachine
f1e34852a9ec14359e4c579768ad8c8705ed9c11
1a0645f095c743ea5686befbb138c4023f6e70ae
refs/heads/master
2022-11-15T02:12:06.588999
2020-07-20T09:28:16
2020-07-20T09:28:16
281,073,506
0
0
null
null
null
null
UTF-8
C++
false
false
231
h
#ifndef WIFI_H #define WIFI_H #include "custom_Websocket.h" namespace wifi { bool turnOn_api(); bool connect_wifi(const char* SSID, const char* PASS); void main(custom_Websocket* socket, open_file* file); }; #endif //WIFI_H
[ "55552148+ichigovishal@users.noreply.github.com" ]
55552148+ichigovishal@users.noreply.github.com
b32fa9e328d0105a0875d32eafddc0e693bdfa1d
cec628def1aad94ccbefa814d2a0dbd51588e9bd
/cnd.highlight/test/unit/data/org/netbeans/modules/cnd/highlight/error/UnresolvedIdentifierTest/bug211143_2.cpp
d5e7cb9be49cc00cc9f7f8b4ab8acbb8c4f11339
[]
no_license
emilianbold/netbeans-releases
ad6e6e52a896212cb628d4522a4f8ae685d84d90
2fd6dc84c187e3c79a959b3ddb4da1a9703659c7
refs/heads/master
2021-01-12T04:58:24.877580
2017-10-17T14:38:27
2017-10-17T14:38:27
78,269,363
30
15
null
2020-10-13T08:36:08
2017-01-07T09:07:28
null
UTF-8
C++
false
false
256
cpp
#include "inc211143.h" Theme211143::~Theme211143() { // Be sure things are destroyed in the right order (XXX check) m_vars = 10; } void Theme211143::loadConfig() { m_windowManager = 0; } void Theme211143::saveConfig() { m_vars = 111; }
[ "vv159170@netbeans.org" ]
vv159170@netbeans.org
08ace8ec751f903931297b53a5a9e6fd24080ffc
5279fdde651ecb50ee7e178a6351156437b7f069
/BAPSServerAssembly/LogManager.cpp
e057671a7e186aef0bbf1744a7dc5d4bb8866347
[ "BSD-3-Clause" ]
permissive
UniversityRadioYork/BAPS2
587bb8ed6864e719eca406e31d2c2eda38d0e36a
af80b66cdd7a980cf34714bef7b5260167714ca5
refs/heads/master
2022-03-07T16:35:51.735951
2019-05-26T19:19:19
2019-05-26T19:19:19
80,321,106
4
1
BSD-3-Clause
2019-05-26T19:19:20
2017-01-29T00:45:05
C
UTF-8
C++
false
false
2,657
cpp
#include "stdafx.h" #include "LogManager.h" #include "Exceptions.h" using namespace BAPSServerAssembly; /** * This class provides global Logging functionality **/ using namespace System::Diagnostics; void LogManager::initLogManager() { try { System::String^ logName = CONFIG_GETSTR(CONFIG_LOGNAME); System::String^ logSource = CONFIG_GETSTR(CONFIG_LOGSOURCE); // Does the Log already exist? if (!EventLog::Exists(logName)) { // Does the event source already exist? if (EventLog::SourceExists(logSource)) { // Delete the event source as it can // only be associated with one log EventLog::DeleteEventSource(logSource); } // Create the event source and associate it // with the new custom log. EventLog::CreateEventSource(logSource, logName); } log = gcnew EventLog(logName, ".", logSource); } catch (System::Exception^ e) { throw gcnew BAPSTerminateException(System::String::Concat("LogManager failed to initialize:\n", e->Message, "Stack Trace:\n",e->StackTrace)); } } void LogManager::closeLogManager() { try { if (log != nullptr) { log->Close(); } } catch (System::Exception^ e) { emergency(System::String::Concat("LogManager failed to close:\n", e->Message, "Stack Trace:\n",e->StackTrace)); } } void LogManager::emergency(System::String^ message) { /** NO EXCEPTION HANDLING: This is emergency logging code and therefore there is nowhere else to attempt to log after this attempt. The system will catch the exception and generate an Application Error log automatically **/ System::Diagnostics::EventLog^ emergLog = gcnew EventLog("Application", ".", "BAPSServerService"); emergLog->WriteEntry(message, EventLogEntryType::Error, 0); emergLog->Close(); } void LogManager::write(System::String^ message, LogLevel level, LogEvent event) { try { switch (level) { case LOG_INFO: { log->WriteEntry(message, EventLogEntryType::Information, event); break; } case LOG_WARNING: { log->WriteEntry(message, EventLogEntryType::Warning, event); break; } case LOG_ERROR: { /** WORK NEEDED: consider getting a backtrace/stack unwind **/ log->WriteEntry(message, EventLogEntryType::Error, event); break; } default: { log->WriteEntry(System::String::Concat("INVALID LOG TYPE: ", System::Convert::ToString(level), "\n",message), EventLogEntryType::Error, event); break; } } } catch (System::Exception^ e) { emergency(System::String::Concat("Failed to write to custom BAPS log. Message being written was:\n", message, "\nException information:\n", e->Message, "Stack Trace:\n",e->StackTrace)); } }
[ "mat" ]
mat
cb6fedc9d57d7ab06979d0c4b605669118172331
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/squid/new_hunk_6122.cpp
ff3bbffdc75e96354e920bc457854290a150175e
[]
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
UTF-8
C++
false
false
520
cpp
COMM_NONBLOCKING, "WCCP Port"); theInGreConnection = comm_open(SOCK_RAW, GRE_PROTOCOL, Config.Addrs.wccp_incoming, 0, COMM_NONBLOCKING, "GRE Port"); leave_suid(); if ((theInWccpConnection < 0) || (theInGreConnection < 0)) fatal("Cannot open WCCP Port"); commSetSelect(theInWccpConnection, COMM_SELECT_READ, wccpHandleUdp, NULL, 0); commSetSelect(theInGreConnection, COMM_SELECT_READ, wccpHandleGre, NULL, 0); debug(1, 1) ("Accepting WCCP UDP messages on port %d, FD %d.\n",
[ "993273596@qq.com" ]
993273596@qq.com
3224f03bd09e05889dfb93fc5c134ac587c337f1
e192bb584e8051905fc9822e152792e9f0620034
/tags/sources_0_1/base/test/test_liste.cpp
6e2cea84cb62fa4e485e418371da2c42cfbe5a95
[]
no_license
BackupTheBerlios/projet-univers-svn
708ffadce21f1b6c83e3b20eb68903439cf71d0f
c9488d7566db51505adca2bc858dab5604b3c866
refs/heads/master
2020-05-27T00:07:41.261961
2011-07-31T20:55:09
2011-07-31T20:55:09
40,817,685
0
0
null
null
null
null
ISO-8859-1
C++
false
false
4,819
cpp
/*************************************************************************** * Copyright (C) 2004 by Projet Univers * * rogma.boami@free.fr * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "test_liste.h" #include "liste_association.h" #include "iterateur_liste_association.h" CPPUNIT_TEST_SUITE_REGISTRATION(ProjetUnivers::Base::Test::TestListe) ; namespace ProjetUnivers { namespace Base { namespace Test { // une classe comme ça class ElementTestListe { public: Entier valeur ; ElementTestListe(const Entier _e) : valeur(_e) {} ~ElementTestListe() { // le destructeur marque sa destruction. ++nombreDObjetsDetruits ; } // un drapeau pour savoir combien d'élément de TempComposition // ont été détruit static Entier nombreDObjetsDetruits ; }; Entier ElementTestListe::nombreDObjetsDetruits = 0 ; void TestListe::TestDestruction() { // on ouvre un nouveau bloc, ses variables temporaires sont détruites // à la sortie { // ListeComposition< ElementTestListe > liste2 ; Composition< ElementTestListe > element1(new ElementTestListe(1)) ; Composition< ElementTestListe > element2(new ElementTestListe(2)) ; liste2.AjouterEnTete(element1.Liberer()) ; liste2.AjouterEnTete(element2.Liberer()) ; } // ici liste2 est détruite et ses doivent l'être aussi CPPUNIT_ASSERT(ElementTestListe::nombreDObjetsDetruits == 2 ) ; } void TestListe::TestAjouter() { // ListeAssociation< ElementTestListe > temp ; Composition< ElementTestListe > element1(new ElementTestListe(1)) ; Composition< ElementTestListe > element2(new ElementTestListe(2)) ; temp.AjouterEnTete(element1) ; temp.AjouterEnTete(element2) ; CPPUNIT_ASSERT(temp.NombreDElements() == 2) ; CPPUNIT_ASSERT(temp.Contient(element1)) ; CPPUNIT_ASSERT(temp.Contient(element2)) ; Entier resultat(0) ; for( IterateurListeAssociation< ElementTestListe > i(temp) ; i.Valide() ; ++i) resultat += i->valeur ; CPPUNIT_ASSERT(resultat == 3) ; } ListeAssociation< ElementTestListe > TestListe::f() { return liste ; } void TestListe::TestParcoursListeTemporaire() { Entier resultat(0) ; // itération sur une liste temporaire for( IterateurListeAssociation< ElementTestListe > i(f()) ; i.Valide() ; ++i) resultat += i->valeur ; CPPUNIT_ASSERT(resultat == 3) ; resultat = 0 ; for( IterateurListeComposition< ElementTestListe > j(liste) ; j.Valide() ; ++j) resultat += j->valeur ; CPPUNIT_ASSERT(resultat == 3) ; } void TestListe::setUp() { // ElementTestListe::nombreDObjetsDetruits = 0 ; liste.AjouterEnTete(new ElementTestListe(1)) ; liste.AjouterEnTete(new ElementTestListe(2)) ; } void TestListe::tearDown() { // liste.Vider() ; } } } }
[ "rogma@fb75c231-3be1-0310-9bb4-c95e2f850c73" ]
rogma@fb75c231-3be1-0310-9bb4-c95e2f850c73
fd77e59eed53380c00c1ac941d3d926fb628dd54
7b6c8389b49191105e6afdc4ed28c056d3023739
/src/st_handeye_visp.cpp
a960e4709980c35bfa8a40ed98e749bf5583dd36
[]
no_license
dtyugin/st_handeye_graph
ed450fc2b58929ef26529c50dc31e6a2276adaa4
e2f21e22fae942c7d7963ba6c6a2c7a2754a808b
refs/heads/master
2023-02-03T22:50:54.809526
2020-02-29T11:22:29
2020-02-29T11:22:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,818
cpp
#include <regex> #include <random> #include <fstream> #include <iostream> #include <Eigen/Dense> #include <boost/format.hpp> #include <boost/filesystem.hpp> #include <opencv2/opencv.hpp> #include <visp/vpDebug.h> #include <visp/vpPoint.h> #include <visp/vpCalibration.h> #include <visp/vpExponentialMap.h> #include <st_handeye/st_handeye.hpp> namespace st_handeye { cv::Mat eigen2cvmat(const Eigen::MatrixXd& matrix) { cv::Mat cv_mat(matrix.rows(), matrix.cols(), CV_64FC1); for(int i=0; i<matrix.rows(); i++) { for(int j=0; j<matrix.cols(); j++) { cv_mat.at<double>(i, j) = matrix(i, j); } } return cv_mat; } Eigen::MatrixXd cvmat2eigen(const cv::Mat& matrix) { Eigen::MatrixXd eigen_mat(matrix.rows, matrix.cols); for(int i=0; i<matrix.rows; i++) { for(int j=0; j<matrix.cols; j++) { eigen_mat(i, j) = matrix.at<double>(i, j); } } return eigen_mat; } vpHomogeneousMatrix eigen2vpmat(const Eigen::MatrixXd& matrix) { vpHomogeneousMatrix vpmat; for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { vpmat[i][j] = matrix(i, j); } } return vpmat; } Eigen::MatrixXd vpmat2eigen(const vpHomogeneousMatrix& matrix) { Eigen::MatrixXd eigen_mat(4, 4); for(int i=0; i<4; i++) { for(int j=0; j<4; j++) { eigen_mat(i, j) = matrix[i][j]; } } return eigen_mat; } std::vector<Eigen::Isometry3d> calc_object2eyes( const Eigen::Matrix3d& camera_matrix, const Eigen::MatrixXd& pattern_3d, const std::vector<Eigen::MatrixXd>& pattern_2ds ) { cv::Mat cv_camera_matrix = eigen2cvmat(camera_matrix); cv::Mat cv_pattern_3d = eigen2cvmat(pattern_3d); std::vector<Eigen::Isometry3d> object2eyes(pattern_2ds.size()); for(int i=0; i<pattern_2ds.size(); i++) { cv::Mat cv_pattern_2d = eigen2cvmat(pattern_2ds[i]); cv::Mat rvec, tvec; cv::solvePnP(cv_pattern_3d.t(), cv_pattern_2d.t(), cv_camera_matrix, cv::Mat(), rvec, tvec); cv::Mat rotation; cv::Rodrigues(rvec, rotation); Eigen::Isometry3d object2eye = Eigen::Isometry3d::Identity(); object2eye.translation() = cvmat2eigen(tvec); object2eye.linear() = cvmat2eigen(rotation); object2eyes[i] = object2eye; } return object2eyes; } /** * @brief estimates hane-eye transformation using Tsai's algorithm */ bool spatial_calibration_visp ( const Eigen::Matrix3d& camera_matrix, const Eigen::MatrixXd& pattern_3d, const std::vector<Eigen::Isometry3d>& world2hands, const std::vector<Eigen::MatrixXd>& pattern_2ds, Eigen::Isometry3d& hand2eye, Eigen::Isometry3d& object2world, OptimizationParams params ) { std::vector<Eigen::Isometry3d> object2eyes = calc_object2eyes(camera_matrix, pattern_3d, pattern_2ds); std::vector<vpHomogeneousMatrix> vp_eye2objects; std::vector<vpHomogeneousMatrix> vp_world2hands; for(int i=0; i<world2hands.size(); i++) { vp_eye2objects.push_back(eigen2vpmat(object2eyes[i].matrix())); vp_world2hands.push_back(eigen2vpmat(world2hands[i].inverse().matrix())); } vpHomogeneousMatrix vp_hand2eye = eigen2vpmat(hand2eye.matrix()); vpCalibration::calibrationTsai(vp_eye2objects, vp_world2hands, vp_hand2eye); Eigen::Matrix4d hand2eye_ = vpmat2eigen(vp_hand2eye).inverse(); hand2eye.translation() = hand2eye_.block<3, 1>(0, 3); hand2eye.linear() = hand2eye_.block<3, 3>(0, 0); object2world = world2hands[0].inverse() * hand2eye.inverse() * object2eyes[0]; return true; } /** * @brief estimates hane-eye transformation using Dual quaternions-based method */ bool spatial_calibration_dualquaternion ( const Eigen::Matrix3d& camera_matrix, const Eigen::MatrixXd& pattern_3d, const std::vector<Eigen::Isometry3d>& world2hands, const std::vector<Eigen::MatrixXd>& pattern_2ds, Eigen::Isometry3d& hand2eye, Eigen::Isometry3d& object2world, OptimizationParams params ) { std::vector<Eigen::Isometry3d> object2eyes = calc_object2eyes(camera_matrix, pattern_3d, pattern_2ds); long pid = getpid(); long rnd = random(); std::string input_filename = (boost::format("/tmp/poses_%d_%d.yml") % pid % rnd).str(); std::string output_filename = (boost::format("/tmp/handeye_%d_%d.yml") % pid % rnd).str(); std::string nodename = (boost::format("handeye_calib_camodocal_%d_%d") % pid % rnd).str(); cv::FileStorage fs(input_filename, cv::FileStorage::WRITE); fs << "frameCount" << static_cast<int>(world2hands.size()); for(int i=0; i<world2hands.size(); i++) { cv::Mat cv_world2hand = eigen2cvmat(world2hands[i].inverse().matrix()); cv::Mat cv_object2eye = eigen2cvmat(object2eyes[i].inverse().matrix()); fs << (boost::format("T1_%d") % i).str() << cv_world2hand; fs << (boost::format("T2_%d") % i).str() << cv_object2eye; } fs.release(); std::stringstream sst; sst << "rosrun handeye_calib_camodocal handeye_calib_camodocal " << "__name:=" << nodename << " " << "_load_transforms_from_file:=true " << "_transform_pairs_load_filename:=" << input_filename << " " << "_output_calibrated_transform_filename:=" << output_filename; std::string command = sst.str(); std::cout << "command: " << command << std::endl; if(system(command.c_str())) { return false; } cv::FileStorage ifs(output_filename, cv::FileStorage::READ); cv::Mat cv_hand2eye; ifs["ArmTipToMarkerTagTransform"] >> cv_hand2eye; Eigen::Matrix4d h2e = cvmat2eigen(cv_hand2eye); hand2eye = Eigen::Isometry3d(h2e).inverse(); object2world = world2hands[0].inverse() * hand2eye.inverse() * object2eyes[0]; return true; } }
[ "koide@aisl.cs.tut.ac.jp" ]
koide@aisl.cs.tut.ac.jp
4f2cf35b743a789001c196372650a3dce7d52cc4
2d8e81d50fcb5bef8a3d0a754821eea5f994b959
/1020.cpp
0f7ecd00e25aaf7cecaa74adb38cfb2078f4eacb
[]
no_license
tasteSoGood/PAT_code
2d77541202ad5f5aba69fcd5518c1cf388dae2fd
b340487f4cc5fbfcefe8784b4e0acb988cccd363
refs/heads/master
2021-01-19T12:26:30.266696
2018-01-15T09:50:09
2018-01-15T09:50:09
100,788,602
0
0
null
null
null
null
UTF-8
C++
false
false
1,628
cpp
#include <iostream> #include <queue> using namespace std; struct binary_tree_node { int number; binary_tree_node *left; binary_tree_node *right; }; binary_tree_node *build_binary_tree(int *p_order, int *i_order, int N){ binary_tree_node *node = new binary_tree_node; node->number = p_order[N - 1]; if(N == 1){ node->left = NULL; node->right = NULL; return node; } int pos; for(int i = 0; i < N; i++) if(i_order[i] == node->number){ pos = i; break; } int *left_p = new int[pos], *left_i = new int[pos]; int *right_p = new int[N - pos - 1], *right_i = new int[N - pos - 1]; for(int i = 0; i < pos; i++) left_p[i] = p_order[i], left_i[i] = i_order[i]; for(int i = 0; i < N - pos - 1; i++) right_p[i] = p_order[i + pos], right_i[i] = i_order[i + pos + 1]; if(pos > 0) node->left = build_binary_tree(left_p, left_i, pos); else if(pos == 0) node->left = NULL; if(N - pos - 1 > 0) node->right = build_binary_tree(right_p, right_i, N - pos - 1); else if(N - pos - 1 == 0) node->right = NULL; delete[] left_p, left_i, right_p, right_i; return node; } int main(){ int N; cin >> N; int post_order[30], in_order[30]; for(int i = 0; i < N; i++) cin >> post_order[i]; for(int i = 0; i < N; i++) cin >> in_order[i]; binary_tree_node *tree = build_binary_tree(post_order, in_order, N); //BFS queue<binary_tree_node *> q; q.push(tree); while(!q.empty()){ if(q.front() != tree) cout << " "; cout << q.front()->number; if(q.front()->left) q.push(q.front()->left); if(q.front()->right) q.push(q.front()->right); q.pop(); } cout << endl; delete tree; return 0; }
[ "970879461@qq.com" ]
970879461@qq.com
16e749dab47c76fac8dc59c5516aa87ed0eacc3a
9969e08bd3fb9653eb40745d4e41e10a382088d6
/extractLines_class_batch_test/main.cpp
3f2dfcfcf6099170e08ef02070f77b3dfc919e74
[]
no_license
yunjieyin/ExtractLines_class
bcd60cd6560e1f666126c6705665400eead6fd6f
99e480970ee328cbbde051d2f69e0b8428efa0ba
refs/heads/master
2020-03-26T23:10:46.226626
2018-08-31T06:05:53
2018-08-31T06:05:53
145,518,055
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
6,022
cpp
#define _SCL_SECURE_NO_WARNINGS #include "extractLines.h" #include <fstream> #include <opencv/cv.h> #include <opencv2/opencv.hpp> #include <highgui.hpp> #include <vector> ///***********************************test function begin******************************************************/ //Scalar random_color(RNG& _rng) //{ // int icolor = (unsigned)_rng; // return Scalar(icolor & 0xFE, (icolor >> 8) & 0xFE, (icolor >> 16) & 0xFE); //} // uchar* MatToArr(cv::Mat img) { /***convert a Mat to a 1D array***/ assert(!img.empty()); uchar *dataPtr = NULL; int row = img.rows; int col = img.cols; dataPtr = (uchar *)malloc((row * col) * sizeof(uchar)); assert(dataPtr != NULL); //copy pixels's elements unsigned int cnt = 0; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { dataPtr[cnt++] = img.at<uchar>(i, j); } } return dataPtr; } // cv::Mat arryToMat(uchar *ptr, unsigned int rows, unsigned int cols) { assert(ptr != NULL && rows * cols != 0); cv::Mat MatImg = cv::Mat(rows, cols, CV_8UC1); uchar *pTmp = NULL; for (int i = 0; i < rows; ++i) { pTmp = MatImg.ptr<uchar>(i); for (int j = 0; j < cols; ++j) { pTmp[j] = ptr[i * cols + j]; } } return MatImg; } ///***********************************test function end******************************************************/ /***************************test function***********************************/ cv::Scalar random_color(cv::RNG& _rng) { int icolor = (unsigned)_rng; return cv::Scalar(icolor & 0xFE, (icolor >> 8) & 0xFE, (icolor >> 16) & 0xFE); } void drawLinesOnSrcImg(cv::Mat& img, std::vector<std::deque<cv::Point>> lines, std::string picName) { if (1) { std::vector<std::vector<cv::Point>> linesVec; for (int i = 0; i < lines.size(); ++i) { std::vector<cv::Point> points; for (int j = 0; j < lines[i].size(); ++j) { cv::Point p; p.x = lines[i][j].x; p.y = lines[i][j].y; points.push_back(p); } linesVec.push_back(points); } cv::Mat draw_img = img.clone(); cv::RNG rng(123); cv::Scalar color; for (int i = 0; i < linesVec.size(); i++) { color = random_color(rng); for (int j = 0; j < linesVec[i].size(); j++) { img.at<cv::Vec3b>(linesVec[i][j]) = cv::Vec3b(color[0], color[1], color[2]); } } int nLineNum = linesVec.size(); std::string str = "lines number = " + std::to_string(nLineNum); cv::putText(img, str, cv::Point(20, 20), cv::FONT_HERSHEY_COMPLEX, 0.5, cv::Scalar(0, 0, 255)); /*the path of to be write*/ //cv::imwrite("E:\\pictures\\coil\\testResult_1D\\" + picName, img); //cv::imwrite("E:\\pictures\\coil\\rawTest\\" + picName, img); //cv::imwrite("E:\\pictures\\coil\\0630Test\\" + picName, img); cv::imwrite("E:\\pictures\\coil\\allTest\\" + picName, img); } } void batch_test() { //std::string dir_path = "E:\\pictures\\coil\\roi_20180820\\"; //std::string dir_path = "E:\\pictures\\coil\\roi(1)\\"; //std::string dir_path = "E:\\pictures\\coil\\raw\\"; //std::string dir_path = "E:\\pictures\\coil\\0630\\"; std::string dir_path = "E:\\pictures\\coil\\all\\"; Directory dir; std::vector<std::string> picNames = dir.GetListFiles(dir_path, "*.bmp", false); std::vector<cv::String> fileNames; //cv::glob("E:\\pictures\\coil\\roi_20180820\\*.bmp", fileNames, true); //cv::glob("E:\\pictures\\coil\\roi(1)\\*.bmp", fileNames, true); //cv::glob("E:\\pictures\\coil\\raw\\*.bmp", fileNames, true); //cv::glob("E:\\pictures\\coil\\0630\\*.bmp", fileNames, true); cv::glob("E:\\pictures\\coil\\all\\*.bmp", fileNames, true); cv::Mat imgSrc; cv::Mat imgGray; for (int i = 0; i < fileNames.size(); ++i) { std::string fileName = fileNames[i]; std::cout << "file name:" << fileName << std::endl; imgSrc = cv::imread(fileName); cv::cvtColor(imgSrc, imgGray, cv::COLOR_BGR2GRAY); uchar* pGray = MatToArr(imgGray); mSize imgSize = { imgSrc.rows, imgSrc.cols }; std::string picName = picNames[i]; //linesData_test(imgSrc, pGray, imgSize, picName); ExtractLines line(pGray, imgSize); line.linesData(); //convert to cv points data std::vector<std::deque<cv::Point>> cv_markedLines; std::deque<cv::Point> cv_line; for (int i = 0; i < line.markedLines.size(); i++) { cv_line.clear(); for (int j = 0; j < line.markedLines[i].size(); j++) { cv::Point cv_pt(line.markedLines[i][j].x, line.markedLines[i][j].y); if (cv_line.size() > 0 && abs(cv_pt.x - cv_line.back().x) > 1 || cv_line.size() > 0 && (cv_pt.x - cv_line.back().x) < 0) { std::cout << "x index strid:" << cv_pt.x << "," << cv_pt.y << "index:" << i << std::endl; } cv_line.push_back(cv_pt); } cv_markedLines.push_back(cv_line); } drawLinesOnSrcImg(imgSrc, cv_markedLines, picName); } } int main() { if (1) { //cv::Mat img = cv::imread("E:\\pictures\\coil\\roi_20180820\\46-7.bmp", 0); /*cv::Mat img = cv::imread("E:\\pictures\\coil\\all\\132-1.bmp", 0); uchar* pImg = MatToArr(img); mSize imgSize = { img.rows, img.cols };*/ /*write array data to file*/ /*if (0) { FILE *fp = NULL; if ((fp = fopen("E:\\pictures\\coil\\data.txt", "w")) == NULL) { printf("open error!"); exit(0); } for (int i = 0; i < imgSize.rows * imgSize.cols; i++) { fprintf(fp, "%d ", pImg[i]); } fclose(fp); }*/ /*read file data to array*/ /*if (0) { uchar* pImgTxt = (uchar *)malloc((imgSize.rows * imgSize.cols) * sizeof(uchar)); if (pImgTxt == NULL) { return 0; } uchar* p = pImgTxt; uchar data; FILE* fp = NULL; fp = (fp = fopen("E:\\pictures\\coil\\data.txt", "r")); if (!fp) { return 0; } int i = 0; while (!feof(fp)) { fscanf(fp, "%d", &data); pImgTxt[i++] = data; } }*/ //Ö÷Èë¿Úº¯Êý /*ExtractLines line(pImg, imgSize); line.linesData(); cv::Mat thin = arryToMat(line.pThinImg, img.rows, img.cols); cv::Mat grd = arryToMat(line.pGrdImg, img.rows, img.cols);*/ batch_test(); } std::getchar(); return 0; }
[ "yunjieyin@163.com" ]
yunjieyin@163.com
b4821c22d59d4a14689e3c85dfecc17ebe7bd72c
235702561f76797e37a2de2a2db29f641eb3915d
/thread1.cpp
58376f88ba004d735652f891f51817320a16afee
[]
no_license
maopd265/ThreadsC
f838f7b0ea70c1fd9d312941737092e4078ca562
c1860402e1ae31a02380a6de76fbcac266967175
refs/heads/main
2023-04-19T09:48:59.067760
2021-05-11T14:23:11
2021-05-11T14:23:11
364,241,330
0
0
null
null
null
null
UTF-8
C++
false
false
747
cpp
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<pthread.h> #include<errno.h> #include<unistd.h> void * does_not(void *a) { int i=0; for(i=0;i<5;i++) { sleep(1); puts("Does not!"); } return NULL; } void * does_too(void *a) { int i=0; for(i=0;i<5;i++) { sleep(1); puts("Does too!"); } return NULL; } void error(char *msg) { fprintf(stderr,"%s: %s \n",msg,strerror(errno)); exit(1); } int main() { pthread_t t0; pthread_t t1; if(pthread_create(&t0,NULL,does_not,NULL)==-1) { error("Can't create thread t0!"); } if(pthread_create(&t1,NULL,does_too,NULL)==-1){ error("Can't create thread t1!"); } sleep(10); }
[ "maopdtec@gmail.com" ]
maopdtec@gmail.com
715c82bef728e77f617d80b48aee6169ed788b79
dc318157c4dd863c0f287e79bf028a9743e4e2fe
/robobug.ino
15293f39d7858a3b197fdc3524f3c1133f1e191a
[]
no_license
asuran/robobug
bd0f3ad5176724f6a2429ec42b9cd92ced187c98
c5b30f41929196f1a3dbcf9ab34df23de6feab09
refs/heads/master
2021-03-12T23:39:05.364267
2014-07-16T09:42:33
2014-07-16T09:42:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,891
ino
#include <Servo.h> #include <Oscillator.h> #include <Ultrasonic.h> class Robobug { public: Oscillator osc_middle; Oscillator osc_left; Oscillator osc_right; Servo grab; int state; //-1 - stop, 0-forward, 1 - left, 2 - right public: void init() { osc_middle.attach(4); // 2,3 and 4 are the digital pins osc_right.attach(2); osc_left.attach(3); osc_middle.SetO(15); // Correction for the offset of the servos osc_right.SetO(0); osc_left.SetO(0); osc_middle.SetA(10); // Middle motor needs a small amplitude (5-10) osc_right.SetA(30); osc_left.SetA(30); osc_middle.SetT(1000); // Set the period of work osc_right.SetT(1000); osc_left.SetT(1000); osc_middle.SetPh(DEG2RAD( 90 )); osc_left.SetPh( DEG2RAD( 0 )); osc_right.SetPh( DEG2RAD( 0 )); state = 0; grab.attach(5); grab.write(120); } void setForwardState() { osc_right.SetPh( DEG2RAD( 0 )); osc_left.SetPh( DEG2RAD( 0 )); state = 0; } void setLeftState() { osc_right.SetPh( DEG2RAD( 0 )); osc_left.SetPh( DEG2RAD( 180 )); } void setRightState() { osc_right.SetPh( DEG2RAD( 180 )); osc_left.SetPh( DEG2RAD( 0 )); } void setBackState() { osc_right.SetPh( DEG2RAD( 180 )); osc_left.SetPh( DEG2RAD( 180 )); } void setRandomTurnState() { if(state == 0) { if(random(2) == 0) { state = 1; } else { state = 2; } } int time1 = millis(); int time2 = millis(); while(time2 - time1 < 5000) { time2 = millis(); switch(state) { case 1: setLeftState(); break; case 2: setRightState(); break; } refresh(); } } void setStopState() { state = -1; } void refresh() { if(state >= 0) { osc_middle.refresh(); osc_right.refresh(); osc_left.refresh(); } } bool hasObject() { return !digitalRead(6); } void clench() { grab.write(170); } void unclench() { grab.write(120); } }; Robobug robot; Ultrasonic ultrasonic(12, 11); void setup() { randomSeed(analogRead(0)); robot.init(); } void loop() { unsigned int time = millis(); if(checkRange(20)) { robot.setRandomTurnState(); } else if(robot.hasObject()) { robot.setStopState(); robot.clench(); } else { robot.setForwardState(); robot.unclench(); } robot.refresh(); } bool checkRange(int distanse) { static int i = 0; static int resultsArray[20] = {distanse}; int sum = 0, average = 0; int dist = ultrasonic.Ranging(1); //CM if(dist > 0 && dist < 1000) { resultsArray[i] = dist; if(i < 10) { i++; } else { i=0; } } for(int j = 0; j < 10; j++) { sum += resultsArray[j]; } average = sum / 10; if(average < distanse) { return true; } else { return false; } }
[ "dmitriy0407@gmail.com" ]
dmitriy0407@gmail.com
dd1b364344a5ede56ada00630a898ced8a3c2ea5
7595f12a2a540868b5cb9cb955494d2060d18904
/gcj/2008/1A_B.cpp
6bdcadfcda939becf1015f92ea89b1dd8f56a3d5
[]
no_license
george24601/cp
eca845494b8e6155059d0d6615ea48b746055cbd
9a3568355824a1ce8fdac625f05e921ec245762b
refs/heads/master
2021-01-16T23:58:14.301165
2020-07-14T01:24:28
2020-07-14T01:24:28
58,160,892
0
0
null
null
null
null
UTF-8
C++
false
false
2,498
cpp
#include <iostream> #include <sstream> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> #include <vector> #include <iomanip> #include <set> #include <map> #include <stack> #include <queue> #include <bitset> using namespace std; typedef unsigned long long UL; typedef long long LL; #define LP(i, a, b) for (int i = int(a); i < int(b); i++) #define LPE(i, a, b) for (int i = int(a); i <= int(b); i++) typedef pair<int, int> PII; typedef vector<vector<PII> > WAL; typedef vector<vector<int> > SAL; #define INF 2000000000 #define Ep 1e-9 /* allgood = false while(!allgood) allgood = true; if (not satifisied) { allgood is false } */ //literal starts with 1 //clause starts with 0 int const MaxLit = 2020; int const MaxClause = 2020; bitset<MaxLit> ans; //all 1, turn to 0 int clausePs[MaxClause]; bitset<MaxLit> clauseNs[MaxClause]; //all 0s, turn to 1 int C, numLit, numClause; //N: literal count, M: clause count void reset() { memset(clausePs, 0, sizeof(clausePs)); ans.reset(); LPE(i, 1, numLit) ans.flip(i); LP(i, 0, numClause){ clauseNs[i].reset(); } } bool unitProp() { bool success = false; while (!success) { success = true; LP(clause, 0, numClause) { int posLit = clausePs[clause]; bool posGood = posLit && !ans[posLit]; //1 in ans means it is FALSE bool negGood = (clauseNs[clause] & ans).any(); //cout << clause << " "<< posLit << " " << posGood << " " << negGood << endl; if (posGood || negGood) continue; //both pos and neg are false, this means we are at form 1...10 success = false; if (posLit) { ans.flip(posLit); //only choice is to flip 0 } else { return false; //we can not flip anymore, as it will revert previous step! } } } return true; } int main() { freopen("/Users/georgeli/Downloads/B-large-practice.in", "r", stdin); //freopen("/Users/georgeli/B_1.in", "r", stdin); freopen("/Users/georgeli/B_small.out", "w", stdout); cin >> C; LPE(cn, 1, C) { cin >> numLit >> numClause; reset(); LP(clause,0, numClause) { int T; cin >> T; LP(lit, 0, T) { int X, Y; cin >> X >> Y; if (Y) clausePs[clause] = X; else clauseNs[clause].flip(X); } } bool result = unitProp(); if (result){ printf("Case #%d:", cn); LPE(i, 1, numLit){ printf(" %d", !ans[i]); } printf("\n"); }else{ printf("Case #%d: IMPOSSIBLE\n", cn); } } return 0; }
[ "movingapple@gmail.com" ]
movingapple@gmail.com
ab535c3b241db616f292d8320d815cf186f477e2
5456502f97627278cbd6e16d002d50f1de3da7bb
/components/arc/intent_helper/font_size_util_unittest.cc
ef5cebe388e550f3ef77de9bdcd09a63a3cdc88a
[ "BSD-3-Clause" ]
permissive
TrellixVulnTeam/Chromium_7C66
72d108a413909eb3bd36c73a6c2f98de1573b6e5
c8649ab2a0f5a747369ed50351209a42f59672ee
refs/heads/master
2023-03-16T12:51:40.231959
2017-12-20T10:38:26
2017-12-20T10:38:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,834
cc
// Copyright 2016 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 "components/arc/intent_helper/font_size_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace arc { TEST(ArcSettingsServiceTest, FontSizeConvertChromeToAndroid) { // Does not return a value smaller than Small. EXPECT_DOUBLE_EQ(kAndroidFontScaleSmall, ConvertFontSizeChromeToAndroid(0, 0, 0)); // Does not return a value larger than Huge EXPECT_DOUBLE_EQ(kAndroidFontScaleHuge, ConvertFontSizeChromeToAndroid(100, 100, 100)); // The max of any Chrome values is what determines the Android value. EXPECT_DOUBLE_EQ(kAndroidFontScaleLarge, ConvertFontSizeChromeToAndroid(20, 0, 0)); EXPECT_DOUBLE_EQ(kAndroidFontScaleLarge, ConvertFontSizeChromeToAndroid(0, 20, 0)); EXPECT_DOUBLE_EQ(kAndroidFontScaleLarge, ConvertFontSizeChromeToAndroid(0, 0, 20)); // default fixed font size is adjusted up three pixels EXPECT_DOUBLE_EQ(kAndroidFontScaleLarge, ConvertFontSizeChromeToAndroid(0, 17, 0)); // Small converts properly. EXPECT_DOUBLE_EQ(kAndroidFontScaleSmall, ConvertFontSizeChromeToAndroid(12, 0, 0)); // Normal converts properly. EXPECT_DOUBLE_EQ(kAndroidFontScaleNormal, ConvertFontSizeChromeToAndroid(16, 0, 0)); // Large converts properly. EXPECT_DOUBLE_EQ(kAndroidFontScaleLarge, ConvertFontSizeChromeToAndroid(20, 0, 0)); // Very large converts properly. EXPECT_DOUBLE_EQ(kAndroidFontScaleHuge, ConvertFontSizeChromeToAndroid(24, 0, 0)); } } // namespace arc
[ "lixiaodonglove7@aliyun.com" ]
lixiaodonglove7@aliyun.com
2ed1bdcce8bfbfd2491147676b14f31d82e87104
69582830440f9d8de3ae83667741826fff09815d
/views/shoppinglistview.h
679b18e79c2c03e4df85aa61298815eb076af2b1
[]
no_license
SimicDomagoj/Cookbook
f6094ce687d25b2510a9151066da3d06628f4c35
6a1464d26563457c07b72d9eaa854a1d97a78e5f
refs/heads/master
2022-07-16T14:22:54.375407
2022-06-15T19:25:26
2022-06-15T19:25:26
182,816,934
0
1
null
null
null
null
UTF-8
C++
false
false
456
h
#pragma once #include<vector> #include<string> class ShoppingListController; class ShoppingListView { public: ShoppingListView(ShoppingListController& controller); virtual void show() = 0; virtual void setList(std::vector<std::string>& list) = 0; virtual void close() = 0; virtual void enableEditing() = 0; virtual void disableEditing() = 0; virtual ~ShoppingListView(); protected: ShoppingListController& controller; };
[ "domagoj.simic0@gmail.com" ]
domagoj.simic0@gmail.com
e87f12252b404435c1d4e71b71ae92141faabbc3
a2cd609a52eb5be16a248c054fb014394f12d344
/devel/include/costmap_converter/ObstacleArrayMsg.h
4b53a6b75b3aac2aa942558cd41322de70217e50
[]
no_license
rfzeg/simon_thesis_ws
c5e6d6b20ee63010ffede91d17ba144527e5f6c5
dc79635f628dade14cab1a631cc4eb24aee1762c
refs/heads/master
2021-09-16T12:43:41.270235
2018-06-20T12:40:57
2018-06-20T12:40:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,154
h
// Generated by gencpp from file costmap_converter/ObstacleArrayMsg.msg // DO NOT EDIT! #ifndef COSTMAP_CONVERTER_MESSAGE_OBSTACLEARRAYMSG_H #define COSTMAP_CONVERTER_MESSAGE_OBSTACLEARRAYMSG_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> #include <std_msgs/Header.h> #include <costmap_converter/ObstacleMsg.h> namespace costmap_converter { template <class ContainerAllocator> struct ObstacleArrayMsg_ { typedef ObstacleArrayMsg_<ContainerAllocator> Type; ObstacleArrayMsg_() : header() , obstacles() { } ObstacleArrayMsg_(const ContainerAllocator& _alloc) : header(_alloc) , obstacles(_alloc) { (void)_alloc; } typedef ::std_msgs::Header_<ContainerAllocator> _header_type; _header_type header; typedef std::vector< ::costmap_converter::ObstacleMsg_<ContainerAllocator> , typename ContainerAllocator::template rebind< ::costmap_converter::ObstacleMsg_<ContainerAllocator> >::other > _obstacles_type; _obstacles_type obstacles; typedef boost::shared_ptr< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> const> ConstPtr; }; // struct ObstacleArrayMsg_ typedef ::costmap_converter::ObstacleArrayMsg_<std::allocator<void> > ObstacleArrayMsg; typedef boost::shared_ptr< ::costmap_converter::ObstacleArrayMsg > ObstacleArrayMsgPtr; typedef boost::shared_ptr< ::costmap_converter::ObstacleArrayMsg const> ObstacleArrayMsgConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> & v) { ros::message_operations::Printer< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace costmap_converter namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True} // {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'costmap_converter': ['/home/simoneforno/simon_ws/src/costmap_converter/msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct IsFixedSize< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> const> : FalseType { }; template <class ContainerAllocator> struct IsMessage< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> const> : TrueType { }; template<class ContainerAllocator> struct MD5Sum< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > { static const char* value() { return "049430c5648abe534a4b6d6dda80f5bd"; } static const char* value(const ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x049430c5648abe53ULL; static const uint64_t static_value2 = 0x4a4b6d6dda80f5bdULL; }; template<class ContainerAllocator> struct DataType< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > { static const char* value() { return "costmap_converter/ObstacleArrayMsg"; } static const char* value(const ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > { static const char* value() { return "# Message that contains a list of polygon shaped obstacles.\n\ # Special types:\n\ # Polygon with 1 vertex: Point obstacle\n\ # Polygon with 2 vertices: Line obstacle\n\ # Polygon with more than 2 vertices: First and last points are assumed to be connected\n\ \n\ std_msgs/Header header\n\ \n\ costmap_converter/ObstacleMsg[] obstacles\n\ \n\ \n\ ================================================================================\n\ MSG: std_msgs/Header\n\ # Standard metadata for higher-level stamped data types.\n\ # This is generally used to communicate timestamped data \n\ # in a particular coordinate frame.\n\ # \n\ # sequence ID: consecutively increasing ID \n\ uint32 seq\n\ #Two-integer timestamp that is expressed as:\n\ # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\ # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\ # time-handling sugar is provided by the client library\n\ time stamp\n\ #Frame this data is associated with\n\ # 0: no frame\n\ # 1: global frame\n\ string frame_id\n\ \n\ ================================================================================\n\ MSG: costmap_converter/ObstacleMsg\n\ # Special types:\n\ # Polygon with 1 vertex: Point obstacle\n\ # Polygon with 2 vertices: Line obstacle\n\ # Polygon with more than 2 vertices: First and last points are assumed to be connected\n\ \n\ std_msgs/Header header\n\ \n\ # Obstacle footprint (polygon descriptions)\n\ geometry_msgs/Polygon polygon\n\ \n\ # Obstacle ID\n\ # Specify IDs in order to provide (temporal) relationships\n\ # between obstacles among multiple messages.\n\ int64 id\n\ \n\ # Individual orientation (centroid)\n\ geometry_msgs/Quaternion orientation\n\ \n\ # Individual velocities (centroid)\n\ geometry_msgs/TwistWithCovariance velocities\n\ \n\ \n\ ================================================================================\n\ MSG: geometry_msgs/Polygon\n\ #A specification of a polygon where the first and last points are assumed to be connected\n\ Point32[] points\n\ \n\ ================================================================================\n\ MSG: geometry_msgs/Point32\n\ # This contains the position of a point in free space(with 32 bits of precision).\n\ # It is recommeded to use Point wherever possible instead of Point32. \n\ # \n\ # This recommendation is to promote interoperability. \n\ #\n\ # This message is designed to take up less space when sending\n\ # lots of points at once, as in the case of a PointCloud. \n\ \n\ float32 x\n\ float32 y\n\ float32 z\n\ ================================================================================\n\ MSG: geometry_msgs/Quaternion\n\ # This represents an orientation in free space in quaternion form.\n\ \n\ float64 x\n\ float64 y\n\ float64 z\n\ float64 w\n\ \n\ ================================================================================\n\ MSG: geometry_msgs/TwistWithCovariance\n\ # This expresses velocity in free space with uncertainty.\n\ \n\ Twist twist\n\ \n\ # Row-major representation of the 6x6 covariance matrix\n\ # The orientation parameters use a fixed-axis representation.\n\ # In order, the parameters are:\n\ # (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)\n\ float64[36] covariance\n\ \n\ ================================================================================\n\ MSG: geometry_msgs/Twist\n\ # This expresses velocity in free space broken into its linear and angular parts.\n\ Vector3 linear\n\ Vector3 angular\n\ \n\ ================================================================================\n\ MSG: geometry_msgs/Vector3\n\ # This represents a vector in free space. \n\ # It is only meant to represent a direction. Therefore, it does not\n\ # make sense to apply a translation to it (e.g., when applying a \n\ # generic rigid transformation to a Vector3, tf2 will only apply the\n\ # rotation). If you want your data to be translatable too, use the\n\ # geometry_msgs/Point message instead.\n\ \n\ float64 x\n\ float64 y\n\ float64 z\n\ "; } static const char* value(const ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.header); stream.next(m.obstacles); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct ObstacleArrayMsg_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::costmap_converter::ObstacleArrayMsg_<ContainerAllocator>& v) { s << indent << "header: "; s << std::endl; Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header); s << indent << "obstacles[]" << std::endl; for (size_t i = 0; i < v.obstacles.size(); ++i) { s << indent << " obstacles[" << i << "]: "; s << std::endl; s << indent; Printer< ::costmap_converter::ObstacleMsg_<ContainerAllocator> >::stream(s, indent + " ", v.obstacles[i]); } } }; } // namespace message_operations } // namespace ros #endif // COSTMAP_CONVERTER_MESSAGE_OBSTACLEARRAYMSG_H
[ "s.forno@student.tue.nl" ]
s.forno@student.tue.nl
86a3efb943abd57a354703b7d9c2508d2b50e931
9030481ef925278a174cbbf58c74bc5058e8d302
/src/versionbits.h
ca8c5448e45b0181a3b93eb7435b9f10b27afc9d
[ "MIT" ]
permissive
hideoussquid/aureus-13-gui
1b8f85f262cbc1970c3d8072b064956073bc4182
8865c958ba1680d4615128dabcc3cc4d47a24c51
refs/heads/master
2021-01-19T08:22:45.795165
2017-04-26T07:34:19
2017-04-26T07:34:19
87,622,430
0
0
null
null
null
null
UTF-8
C++
false
false
2,614
h
// Copyright (c) 2016 The Aureus Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef AUREUS_CONSENSUS_VERSIONBITS #define AUREUS_CONSENSUS_VERSIONBITS #include "chain.h" #include <map> /** What block version to use for new blocks (pre versionbits) */ static const int32_t VERSIONBITS_LAST_OLD_BLOCK_VERSION = 4; /** What bits to set in version for versionbits blocks */ static const int32_t VERSIONBITS_TOP_BITS = 0x20000000UL; /** What bitmask determines whether versionbits is in use */ static const int32_t VERSIONBITS_TOP_MASK = 0xE0000000UL; /** Total bits available for versionbits */ static const int32_t VERSIONBITS_NUM_BITS = 29; enum ThresholdState { THRESHOLD_DEFINED, THRESHOLD_STARTED, THRESHOLD_LOCKED_IN, THRESHOLD_ACTIVE, THRESHOLD_FAILED, }; // A map that gives the state for blocks whose height is a multiple of Period(). // The map is indexed by the block's parent, however, so all keys in the map // will either be NULL or a block with (height + 1) % Period() == 0. typedef std::map<const CBlockIndex*, ThresholdState> ThresholdConditionCache; struct BIP9DeploymentInfo { /** Deployment name */ const char *name; /** Whether GBT clients can safely ignore this rule in simplified usage */ bool gbt_force; }; extern const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[]; /** * Abstract class that implements BIP9-style threshold logic, and caches results. */ class AbstractThresholdConditionChecker { protected: virtual bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const =0; virtual int64_t BeginTime(const Consensus::Params& params) const =0; virtual int64_t EndTime(const Consensus::Params& params) const =0; virtual int Period(const Consensus::Params& params) const =0; virtual int Threshold(const Consensus::Params& params) const =0; public: // Note that the function below takes a pindexPrev as input: they compute information for block B based on its parent. ThresholdState GetStateFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const; }; struct VersionBitsCache { ThresholdConditionCache caches[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]; void Clear(); }; ThresholdState VersionBitsState(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache); uint32_t VersionBitsMask(const Consensus::Params& params, Consensus::DeploymentPos pos); #endif
[ "thesquid@mac.com" ]
thesquid@mac.com
f63d6f13d6b340a995c07f8ca28f8d0b39a17668
f5110ca088f5dc76f36f68a3af1423719680c628
/a2oj/2B/CF122.cpp
40f360a6bc897394a494410571d067d06c7abc37
[]
no_license
tejas1995/SPOJ-solutions
73ea196a170dd1b0c80c123b8e0c1bfe82d3da0b
fb7b1e8c1f729860661a09c9999405a734da902e
refs/heads/master
2021-01-10T02:57:59.691488
2016-01-14T09:23:55
2016-01-14T09:23:55
47,422,853
0
0
null
null
null
null
UTF-8
C++
false
false
392
cpp
//http://codeforces.com/problemset/problem/122/B #include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; int num4 = 0, num7 = 0; for(int i = 0; i < s.length(); i++) if(s[i] == '4') num4++; else if(s[i] == '7') num7++; if(num4 == 0 && num7 == 0) cout << "-1\n"; else if(num4 >= num7) cout << "4\n"; else cout << "7\n"; return 0; }
[ "tejas.srinivasan95@gmail.com" ]
tejas.srinivasan95@gmail.com
c47594bdec49fe8947849557fdd632d27ca0c688
44c1d55b12014de78edfc020208aeee87910b50c
/scroll_nodes/CCScrollLayerExt.h
8357b6b73f6cefe40c13291899c88887d9f25bb7
[ "MIT" ]
permissive
BoolkaSDK/gd.h-android
f92e359d246e0857e0421ba95f4b4c8a8ad13dc1
d849abf0962b56139257abe38543dfd0cb97efcb
refs/heads/main
2023-06-10T15:31:56.444813
2021-07-03T13:23:04
2021-07-03T13:23:04
466,213,017
1
0
null
null
null
null
UTF-8
C++
false
false
1,054
h
#ifndef __CCSCROLLLAYEREXT_H__ #define __CCSCROLLLAYEREXT_H__ #include <gd.h> class CCContentLayer; class CCScrollLayerExt : public cocos2d::CCLayer { protected: PAD(4); cocos2d::CCPoint m_obUnknown1; cocos2d::CCPoint m_obUnknown2; PAD(8); bool m_bUnknown1; bool m_bUnknown2; cocos2d::CCLayerColor* m_pLayer; PAD(8); CCContentLayer* m_pContentLayer; PAD(16); float m_fScale1; //? float m_fScale2; //? protected: CCScrollLayerExt(cocos2d::CCRect rect) ; public: //own vtable virtual void preVisitWithClippingRect(cocos2d::CCRect rect) ; virtual void postVisit(); }; class CCScrollLayerExtDelegate { public: //lol nice typo rob virtual void scrllViewWillBeginDecelerating(CCScrollLayerExt*) {} virtual void scrollViewDidEndDecelerating(CCScrollLayerExt*) {} virtual void scrollViewTouchMoving(CCScrollLayerExt*) {} virtual void scrollViewDidEndMoving(CCScrollLayerExt*) {} virtual void scrollViewTouchBegin(CCScrollLayerExt*) {} virtual void scrollViewTouchEnd(CCScrollLayerExt*) {} }; #endif
[ "marco@ema.com" ]
marco@ema.com
e900f9bb5c2be0a6ebb6e90f768b32bb498ab49b
60205084cab945880a323a10c9fc3894c0b8ffee
/a3controller/src/pilot/include/pilot/pilot_node.h
a99ac19903cf7d6000880f453dfb019790a915ed
[]
no_license
KCLI2000/LI_Guo_Qiang
36c85883459191f38cdb8ce63006b14029299fe6
dcef084c325a117d413d82ee1f78d27d94dfd621
refs/heads/master
2021-06-18T15:40:13.511241
2021-01-23T07:21:17
2021-01-23T07:21:17
149,882,082
0
0
null
null
null
null
UTF-8
C++
false
false
4,613
h
/** * @file pilot.h * @brief declare the class Pilot and the class Mission * @author mafp * @email 767102280@qq.com * @version 1.0.0 * @date 2019/10/19 */ #ifndef __PILOT_NOTE_H #define __PILOT_NOTE_H #include <ros/ros.h> #include <geometry_msgs/Vector3.h> #include <geometry_msgs/Vector3Stamped.h> #include <geometry_msgs/QuaternionStamped.h> #include <geometry_msgs/PointStamped.h> #include <std_msgs/Float64.h> #include <std_msgs/UInt8.h> #include <std_msgs/Float32.h> #include <sensor_msgs/Joy.h> #include <sensor_msgs/Imu.h> #include <sensor_msgs/NavSatFix.h> #include "pilot/pilot_ctrl_cmd.h" #include <dji_sdk/dji_sdk.h> #include <dji_sdk/DroneTaskControl.h> #include <dji_sdk/SDKControlAuthority.h> #include <dji_sdk/QueryDroneVersion.h> #include <dji_sdk/SetLocalPosRef.h> #include <tf/tf.h> class Pilot { //! 初始化函数及控制函数 public: bool init(); bool obtain_control(); bool takeoff(); bool land(); void setPosHori(float px,float py); void setVelHori(float vx,float vy); void setPosVert(float h); void setVelVert(float v); void setYaw(float yaw); //! 无人机状态变量 private: sensor_msgs::NavSatFix data_gps_position; geometry_msgs::Point data_local_position; geometry_msgs::QuaternionStamped data_attitude; geometry_msgs::Vector3Stamped velocity; std_msgs::Float32 height; sensor_msgs::Imu data_imu; uint8_t flight_status; uint8_t display_mode; float pilot_target_x; float pilot_target_y; float pilot_target_z; /* 无人机执行任务状态 0 ----- 在地上/初始状态 1 ----- 起飞 2 ----- 悬停 3 ----- 水平移动到指定位置 4 ----- 垂直移动到指定高度 5 ----- 降落 6 ----- 执行任务1 ... 待补充 */ uint8_t mission_state = 0; //! ros ServiceClient 及 Publisher protected: ros::ServiceClient sdk_ctrl_authority_service; ros::ServiceClient sdk_drone_task_service; ros::ServiceClient sdk_drone_arm_service; ros::ServiceClient sdk_query_version_service; ros::ServiceClient sdk_set_local_ref_service; ros::Publisher ctrl_cmd_pub; ros::Publisher ctrl_PosYaw_pub; //! 无人机状态获取函数 public: geometry_msgs::Vector3 attitude_pull(); //! 把四元数转换成姿态角作为返回值 geometry_msgs::Vector3 position_pull(); //! gps 位置信息 uint8_t flight_status_pull(); //! uint8_t display_mode_pull(); //! geometry_msgs::Vector3 liner_acc_pull(); //! 线加速度 geometry_msgs::Vector3 angular_vel_pull(); //! 角速度 geometry_msgs::Vector3 velocity_pull(); //! ENU坐标系下的速度 float height_pull(); //! 相对起飞点的高度 uint8_t mission_state_pull(); //! 无人机状态更新函数,给callback调用 public: void update_attitude(const geometry_msgs::QuaternionStamped attitude); void update_gps_position(const sensor_msgs::NavSatFix gps_pos); void update_flight_status(const std_msgs::UInt8 status); void update_display_mode(const std_msgs::UInt8 mode); void update_local_position(const geometry_msgs::PointStamped local_position); void update_imu(const sensor_msgs::Imu imu); void update_velocity(const geometry_msgs::Vector3Stamped vel); void update_height(const std_msgs::Float32 h); void update_mission_state(uint8_t state); void set_target(float x,float y,float z); void set_target(float x,float y); void set_target(float z); void control_update(); }; //! ros 回调函数 extern Pilot* p; //! 实例化对象指针 void dji_attitude_callback(const geometry_msgs::QuaternionStamped::ConstPtr& msg); void dji_gps_callback(const sensor_msgs::NavSatFix::ConstPtr& msg); void dji_flight_status_callback(const std_msgs::UInt8::ConstPtr& msg); void dji_display_mode_callback(const std_msgs::UInt8::ConstPtr& msg); void dji_local_position_callback(const geometry_msgs::PointStamped::ConstPtr& msg); void dji_imu_callback(const sensor_msgs::Imu::ConstPtr& msg); void dji_velocity_callback(const geometry_msgs::Vector3Stamped::ConstPtr& msg); void dji_height_callback(const std_msgs::Float32::ConstPtr& msg); void pilot_ctrl_cmd_callback(const pilot::pilot_ctrl_cmd::ConstPtr& msg); #endif
[ "kcli2000@hotmail.com" ]
kcli2000@hotmail.com
ac91d3a42a9626f354da6eb71bff02561f68f8d9
32399df3e1432efd36101d9ca7a722b0bc4cfee9
/src/main.cpp
f0ba91068e3b5ce139e44fa57aa2b758a40c3c42
[ "MIT" ]
permissive
uovie/timer
4c12ad1e007a136dabe76c4d5fae0a2751c227a8
20d81f3725a1274711eb280f06ccd18e5c4e021c
refs/heads/master
2020-07-02T03:51:43.710466
2019-08-09T07:02:05
2019-08-09T07:02:05
201,407,811
0
0
null
null
null
null
UTF-8
C++
false
false
515
cpp
#include <iostream> #include <iomanip> #include "timer.h" using namespace std; using namespace uovie; int main() { int ts; timer::duration p{}; timer::duration q{}; cout << "Please set the time span (s): "; cin >> ts; timer u(ts); u.start(); cout << q.count() << endl; do { q = u.elapse(); if (q != p) { cout << q.count() << endl; p = q; } } while (!u.is_end()); cout << "Timer ends." << endl; return 0; }
[ "uovie@users.noreply.github.com" ]
uovie@users.noreply.github.com
0c71ddd39d797526c29fcd9b122bfd443db8155a
df89a1540a17b08e9d5513c0514ba284fe38e1e6
/PAT/B1022/main.cpp
dd4b95ed88faf195b7fbcd00f8ebaddf5cae255a
[]
no_license
xuyanbo03/Algorithm
3eccab6492af6c75745ff94b2e3d484e6a995af8
c9dd1ac5009475d465793e5d671fa594556b65da
refs/heads/master
2021-01-20T09:37:27.250534
2018-06-18T08:24:15
2018-06-18T08:24:15
90,269,241
0
0
null
null
null
null
UTF-8
C++
false
false
320
cpp
#include <iostream> using namespace std; int main(){ int a,b,d; cin>>a>>b>>d; int c=a+b; int s[100]; int i=0; if(c==0){ cout<<0; return 0; } while(c!=0){ s[i++]=c % d; c = c / d; } for(int j=i-1;j>=0;j--){ cout<<s[j]; } return 0; }
[ "610958401@qq.com" ]
610958401@qq.com
b11ff924e594ad404215bd982f80f5ae3c68b903
b7a6ce79b829cc4a8fbdb2ea606902936e79fbce
/算法/pro4/floyd_warshall.cpp
a716b91019b6bdbec9ffeaadc13e21520e2b4b75
[]
no_license
SJ110/some-kind-of-courses
2308e3510bf3cd88471065eab33c3b07c5dfffcf
7d5ebd0911fd578fb5615fa75d96a624a62f4b00
refs/heads/master
2020-04-18T11:37:48.488258
2019-01-25T07:49:36
2019-01-25T07:49:36
null
0
0
null
null
null
null
GB18030
C++
false
false
2,254
cpp
#include <iostream> #define INF 32767 #define MAX 100 using namespace std; void All_path_floyd_warshall(int n, int (&A)[MAX][MAX], int (&path)[MAX][MAX]) { for (int k = 0; k < n; k++) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (A[i][j] <= A[i][k] + A[k][j]) path[i][j] = path[i][j]; else path[i][j] = path[k][j]; if (A[i][j] > A[i][k] + A[k][j]) A[i][j] = A[i][k] + A[k][j]; } } } } void print_path(int i, int j, int path[MAX][MAX]) { if (i == j) cout << i + 1 << " "; else{ print_path(i, path[i][j], path); cout << j + 1 << " "; } } int main() { freopen("in.dat", "r", stdin); freopen("out.dat", "w", stdout); int m, index; int matrix[MAX][MAX], p_matrix[MAX][MAX]; // matrix 保存最短路径,p_matrix保存所经过的点 cin >> m; //图的组数 cout << m << endl; for (index = 0; index < m; index++) { int n; cin >> n; cout << n << endl; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> matrix[i][j]; if (matrix[i][j] == 100) //没有路径 matrix[i][j] = INF; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j || matrix[i][j] == 100) p_matrix[i][j] = -1;//初始化为-1 else if (i != j || matrix[i][j] < 100) p_matrix[i][j] = i; } } All_path_floyd_warshall(n, matrix, p_matrix); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cout << matrix[i][j] << " "; cout << endl; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { if(matrix[i][j]==INF) cout<<"NULL"; else print_path(i, j, p_matrix); cout << endl; } } return 0; }
[ "1422667041@qq.com" ]
1422667041@qq.com
2b1c6b65f14efef6b9984d97419fb605fb3cd962
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
/devel/poco/patches/patch-Foundation_testsuite_src_DynamicFactoryTest.cpp
c81126f2fff96878184f3a7fe602aba437437db6
[]
no_license
NetBSD/pkgsrc
a0732c023519650ef821ab89c23ab6ab59e25bdb
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
refs/heads/trunk
2023-09-01T07:40:12.138283
2023-09-01T05:25:19
2023-09-01T05:25:19
88,439,572
321
138
null
2023-07-12T22:34:14
2017-04-16T20:04:15
null
UTF-8
C++
false
false
545
cpp
$NetBSD: patch-Foundation_testsuite_src_DynamicFactoryTest.cpp,v 1.1 2012/11/16 00:43:36 joerg Exp $ --- Foundation/testsuite/src/DynamicFactoryTest.cpp.orig 2012-11-14 11:57:05.000000000 +0000 +++ Foundation/testsuite/src/DynamicFactoryTest.cpp @@ -109,7 +109,7 @@ void DynamicFactoryTest::testDynamicFact try { - std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B"))); + std::auto_ptr<B> b2(dynamic_cast<B*>(dynFactory.createInstance("B"))); fail("unregistered - must throw"); } catch (Poco::NotFoundException&)
[ "joerg@pkgsrc.org" ]
joerg@pkgsrc.org
82959b5077708bc310f6c76f33ca578428dd849c
79eb83cc3e7f4324ad3f7e56f094384ee494a7a9
/Model/Kecheng.h
eac30adf936b02671bd53df0645a17dad94d7398
[]
no_license
JiaoMing/Blackcat
4a32ab2ec1abc356a4494ec9177ad0b3128d575b
95fa6f74429ead752741cbff3debca8bb0cbdb6e
refs/heads/master
2020-04-15T11:08:28.111536
2014-11-13T08:40:57
2014-11-13T08:40:57
30,082,134
0
4
null
2015-01-30T17:10:54
2015-01-30T17:10:53
null
UTF-8
C++
false
false
625
h
// // EBook.h // blackcat // // Created by haojunhua on 13-10-18. // // #ifndef blackcat_Kecheng_h #define blackcat_Kecheng_h #include "BaseModel.h" class Kecheng: public BaseModel{ public: EMPTY_CONSTRUCT_DESTRUCT(Kecheng); SYNTHESIZE_KEY(id); SYNTHESIZE_INT(win); SYNTHESIZE_INT(lose); SYNTHESIZE_INT(lastTime); virtual void registTablenameAndProperty(){ tablename="kecheng"; INSERT_PROPERTYMAP(Kecheng,id); INSERT_PROPERTYMAP(Kecheng,win); INSERT_PROPERTYMAP(Kecheng,lose); INSERT_PROPERTYMAP(Kecheng,lastTime); } public: }; #endif
[ "380050803@qq.com" ]
380050803@qq.com
01e376f9559737a428252a9ac68ea691cc10fe98
10c3da46b2b4790a25b2cf6e4a3817ec2e149a84
/libraries/mdlib/MultiColorLED.h
fcf38da7ab9c7854dff902241edcd51893043090
[]
no_license
PapaMarky/ArduinoSketchbook
f9d04609343cfef0e16439b3a8309645c79f8b27
770a842402397be6be51ccfed6bfeee8d9496f58
refs/heads/master
2021-01-01T18:06:54.228424
2015-04-07T05:33:10
2015-04-07T05:33:10
7,977,740
0
0
null
2014-07-26T16:43:12
2013-02-02T15:46:09
C++
UTF-8
C++
false
false
950
h
#ifndef MULTI_COLOR_LED_H #define MULTI_COLOR_LED_H #include "mdBase.h" namespace mdlib { const uint32_t RED = 0x00ff0000; const uint32_t YELLOW = 0x00ffff00; const uint32_t GREEN = 0x0000ff00; const uint32_t TURQUOISE = 0x0000ffff; const uint32_t BLUE = 0x000000ff; const uint32_t PURPLE = 0x00ff00ff; const uint32_t BLACK = 0x00000000; const uint32_t WHITE = 0x00ffffff; class MultiColorLED { public: MultiColorLED(); void setup() const; void update() {}; void set_pins(int red_pin, int green_pin, int blue_pin); void set_color(uint32_t color) const; void TurnOff() { set_color(0); } void blend_colors(uint32_t c1, uint32_t c2, float pct) const; void set_hsv(int h, float s, float v); void set_rgb(int red, int green, int blue); private: AnalogOutput red_; AnalogOutput green_; AnalogOutput blue_; }; } #endif // MULTI_COLOR_LED_H
[ "papamarky@markyshouse.com" ]
papamarky@markyshouse.com
8f497e26b2aa4fc98adbf6fd0fd4fd46033076a1
81ba4c039068682903918f9bbad2390d1acf6ba6
/sort/heapsort.cpp
24da99d735938fcb0bfedefd9b491581e9e5ab35
[]
no_license
WuXing918/test
69641a915b3998b32667b69fdba38fce21800a39
7964177c492742d39ecbc8e9b78dd37543e201a8
refs/heads/master
2020-04-17T03:34:11.368840
2018-03-11T03:08:57
2018-03-11T03:08:57
50,184,410
0
0
null
null
null
null
UTF-8
C++
false
false
1,738
cpp
#include <iostream> using namespace std; void print(int a[], int length) { for (int i = 0; i < length; i++) { cout << a[i] << " "; } cout << endl; } // 我写的好像没有判断根节点 void heapCreate(int a[], int i, int length) { //当前父结点的左子树 int Lchild = 2*i+1; int rchild = 2*i+2; // 存储的当前堆中的临时最大值 // 存储当前堆中的临时最大之的位置 int locate; while(2*i+1 < length) { // 1. 判断出左右子树的大小存储在temp中 if ((2*i+2) < length) { // 判断有右子树 if (a[2*i+1] > a[2*i+2]) { locate = 2*i+1; } else { locate = 2*i+2; } } else { // 判断没有右子树 locate = 2*i+1; } // 判断子节点与父节点大小 if (a[i] >= a[locate]) { // 该树已经是大根堆模式 break; } else { int swap = a[i]; a[i] = a[locate]; a[locate] = swap; i = locate; } } } void heapSort(int a[], int length) { // 创建堆的过从程 for (int i = length/2-1; i >= 0; i--) { // 这个i和a[]下标是没有区别的 heapCreate(a, i, length); } for (int j = length-1; j >= 0; j--) { int temp = a[j]; a[j] = a[0]; a[0] = temp; heapCreate(a, 0, j); } } int main () { int a[] = {7,0,2,6,1,8,3,9,4,5}; int length = sizeof(a)/sizeof(a[0]); print(a, length); heapSort(a, length); print(a, length); }
[ "wuxing@pset.suntec.net" ]
wuxing@pset.suntec.net
1086f1be40cebe0a98125bc90b5e812066deef99
5f9bbacdcb3a12d633280c47f8653b45feb93584
/Cpp/odin-views/secure.tests.cpp
8574dc375278eb81b5727551da83f0200f701ce2
[ "BSL-1.0" ]
permissive
Deuanz/odin
57cbd7c8fb46967b8c26e05df719fcf82fa90f77
da31a6bc8b9b4a0270f0807b588483840a24cf46
refs/heads/master
2020-03-26T10:43:20.057019
2018-06-21T05:40:25
2018-06-21T05:40:25
144,812,465
0
0
BSL-1.0
2018-08-15T06:06:21
2018-08-15T06:06:21
null
UTF-8
C++
false
false
2,367
cpp
/* Copyright 2016 Felspar Co Ltd. http://odin.felspar.com/ Distributed under 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 */ #include <odin/odin.hpp> #include <odin/views.hpp> #include <fost/crypto> #include <fost/test> #include <fost/exception/parse_error.hpp> FSL_TEST_SUITE(secure); namespace { fostlib::json configuration() { fostlib::json config; fostlib::insert(config, "unsecure", "view", "fost.response.401"); fostlib::insert(config, "unsecure", "configuration", "schemes", "Bearer", fostlib::json::object_t()); fostlib::insert(config, "secure", "view", "fost.response.404"); return config; } } FSL_TEST_FUNCTION(check_unsecure_01_missing_authz) { fostlib::http::server::request req("GET", "/"); auto response = odin::view::secure(configuration(), "/", req, fostlib::host()); FSL_CHECK_EQ(response.second, 401); } FSL_TEST_FUNCTION(check_unsecure_02_wrong_scheme) { fostlib::http::server::request req("GET", "/"); req.headers().set("Authorization", "BASIC uname:aabddsd"); auto response = odin::view::secure(configuration(), "/", req, fostlib::host()); FSL_CHECK_EQ(response.second, 401); } FSL_TEST_FUNCTION(check_unsecure_03_missing_token) { fostlib::http::server::request req("GET", "/"); req.headers().set("Authorization", "Bearer"); auto response = odin::view::secure(configuration(), "/", req, fostlib::host()); FSL_CHECK_EQ(response.second, 401); } FSL_TEST_FUNCTION(check_unsecure_04_wrong_token) { fostlib::http::server::request req("GET", "/"); req.headers().set("Authorization", "Bearer ABACAB"); auto response = odin::view::secure(configuration(), "/", req, fostlib::host()); FSL_CHECK_EQ(response.second, 401); } FSL_TEST_FUNCTION(check_secure) { const fostlib::setting<bool> trust_jwt{"odin-views/secure.tests.cpp", odin::c_jwt_trust, true}; fostlib::jwt::mint jwt(fostlib::sha256, odin::c_jwt_secret.value()); jwt.subject("test-user"); fostlib::http::server::request req("GET", "/"); req.headers().set("Authorization", ("Bearer " + jwt.token()).c_str()); auto response = odin::view::secure(configuration(), "/", req, fostlib::host()); FSL_CHECK_EQ(response.second, 404); }
[ "k@kirit.com" ]
k@kirit.com
6489a4ce604ecab4978cbcd39e04354345877457
b14e71190e1911774b9a0fdef813da658655e267
/NewOgreProject/proj/src/ModeleOgre/Base.h
5bc483f2325736d1f7c54d39d6340977290696b1
[]
no_license
vernou/Modelisation_Aeronautique
46d060bbc4c05f75548fb687e83be300a869475b
d890caa3e4e2ae715cd6b5b8331e63fb6cdd47ae
refs/heads/master
2021-05-27T00:05:43.778712
2013-04-29T06:45:53
2013-04-29T06:45:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,086
h
#ifndef BASE_H #define BASE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include "Scene.h" #include "DisplayObject.h" class Base { public: //////////////////////////////////////////////////////////// /// \brief Default constructor /// //////////////////////////////////////////////////////////// Base(Scene& _scene,float _mass = 1.f); //////////////////////////////////////////////////////////// /// \brief Default constructor with scene node parent /// //////////////////////////////////////////////////////////// Base(Scene& _scene,Ogre::SceneNode *parent,float _mass = 1.f); //////////////////////////////////////////////////////////// /// \brief Destructor /// //////////////////////////////////////////////////////////// ~Base(); ///////////////////////////////////////////////// /// \brief Set position to piece /// /// \param x /// \param y /// \param z /// ///////////////////////////////////////////////// void setPosition(float x,float y,float z); ///////////////////////////////////////////////// /// \brief Set position to piece /// /// \param x /// \param y /// \param z /// ///////////////////////////////////////////////// void setPosition(Ogre::Vector3 position); ///////////////////////////////////////////////// /// \brief Return position of piece /// /// \return position of piece /// ///////////////////////////////////////////////// Ogre::Vector3 getPosition(); ///////////////////////////////////////////////// /// \brief Retourne la position du centre de gravite /// /// \return La position du centre de gravite /// ///////////////////////////////////////////////// Ogre::Vector3 getGravityCenter(); ///////////////////////////////////////////////// /// \brief Retourne la position du centre de gravite plus la position du noeud /// /// \return la position du centre de gravite plus la position du noeud /// ///////////////////////////////////////////////// Ogre::Vector3 getGravityCenterMorePosition(); ///////////////////////////////////////////////// /// \brief Créer les objets à afficher pour representer le centre de gravite /// ///////////////////////////////////////////////// void CreateGravityObject(); ///////////////////////////////////////////////// /// \brief Return mass /// /// \return mass value /// ///////////////////////////////////////////////// inline float getMass(){return mass;} public: Scene & scene; ///< Ref to scene Ogre::SceneNode * node; ///< Main node DisplayObject box; ///< Box DisplayObject object; ///< Displayed object DisplayObject gravityCenter; ///< Gravity center of piece float mass; ///< Mass of object }; #endif // BASE_H
[ "sebastien.schaal@etu.univ-tours.fr" ]
sebastien.schaal@etu.univ-tours.fr
ad0d93ace89f544fdcdc2ab291f133d5c7f16ff6
8567438779e6af0754620a25d379c348e4cd5a5d
/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.h
64494de412740787eb14ac3416916d4b1eb48eab
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "MIT", "Apache-2.0", "BSD-3-Clause" ]
permissive
thngkaiyuan/chromium
c389ac4b50ccba28ee077cbf6115c41b547955ae
dab56a4a71f87f64ecc0044e97b4a8f247787a68
refs/heads/master
2022-11-10T02:50:29.326119
2017-04-08T12:28:57
2017-04-08T12:28:57
84,073,924
0
1
BSD-3-Clause
2022-10-25T19:47:15
2017-03-06T13:04:15
null
UTF-8
C++
false
false
4,753
h
/* * Copyright (C) 2010, 2011 Apple 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: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 ScrollAnimatorMac_h #define ScrollAnimatorMac_h #include "platform/Timer.h" #include "platform/WebTaskRunner.h" #include "platform/geometry/FloatPoint.h" #include "platform/geometry/FloatSize.h" #include "platform/geometry/IntRect.h" #include "platform/heap/Handle.h" #include "platform/scroll/ScrollAnimatorBase.h" #include "wtf/RetainPtr.h" #include <memory> OBJC_CLASS BlinkScrollAnimationHelperDelegate; OBJC_CLASS BlinkScrollbarPainterControllerDelegate; OBJC_CLASS BlinkScrollbarPainterDelegate; typedef id ScrollbarPainterController; namespace blink { class Scrollbar; class PLATFORM_EXPORT ScrollAnimatorMac : public ScrollAnimatorBase { USING_PRE_FINALIZER(ScrollAnimatorMac, dispose); public: ScrollAnimatorMac(ScrollableArea*); ~ScrollAnimatorMac() override; void dispose() override; void immediateScrollToOffsetForScrollAnimation(const ScrollOffset& newOffset); bool haveScrolledSincePageLoad() const { return m_haveScrolledSincePageLoad; } void updateScrollerStyle(); bool scrollbarPaintTimerIsActive() const; void startScrollbarPaintTimer(); void stopScrollbarPaintTimer(); void sendContentAreaScrolledSoon(const ScrollOffset& scrollDelta); void setVisibleScrollerThumbRect(const IntRect&); DEFINE_INLINE_VIRTUAL_TRACE() { ScrollAnimatorBase::trace(visitor); } private: RetainPtr<id> m_scrollAnimationHelper; RetainPtr<BlinkScrollAnimationHelperDelegate> m_scrollAnimationHelperDelegate; RetainPtr<ScrollbarPainterController> m_scrollbarPainterController; RetainPtr<BlinkScrollbarPainterControllerDelegate> m_scrollbarPainterControllerDelegate; RetainPtr<BlinkScrollbarPainterDelegate> m_horizontalScrollbarPainterDelegate; RetainPtr<BlinkScrollbarPainterDelegate> m_verticalScrollbarPainterDelegate; void initialScrollbarPaintTask(); TaskHandle m_initialScrollbarPaintTaskHandle; void sendContentAreaScrolledTask(); TaskHandle m_sendContentAreaScrolledTaskHandle; RefPtr<WebTaskRunner> m_taskRunner; ScrollOffset m_contentAreaScrolledTimerScrollDelta; ScrollResult userScroll(ScrollGranularity, const ScrollOffset& delta) override; void scrollToOffsetWithoutAnimation(const ScrollOffset&) override; void cancelAnimation() override; void contentAreaWillPaint() const override; void mouseEnteredContentArea() const override; void mouseExitedContentArea() const override; void mouseMovedInContentArea() const override; void mouseEnteredScrollbar(Scrollbar&) const override; void mouseExitedScrollbar(Scrollbar&) const override; void contentsResized() const override; void contentAreaDidShow() const override; void contentAreaDidHide() const override; void finishCurrentScrollAnimations() override; void didAddVerticalScrollbar(Scrollbar&) override; void willRemoveVerticalScrollbar(Scrollbar&) override; void didAddHorizontalScrollbar(Scrollbar&) override; void willRemoveHorizontalScrollbar(Scrollbar&) override; void notifyContentAreaScrolled(const ScrollOffset& delta) override; bool setScrollbarsVisibleForTesting(bool) override; ScrollOffset adjustScrollOffsetIfNecessary(const ScrollOffset&) const; void immediateScrollTo(const ScrollOffset&); bool m_haveScrolledSincePageLoad; bool m_needsScrollerStyleUpdate; IntRect m_visibleScrollerThumbRect; }; } // namespace blink #endif // ScrollAnimatorMac_h
[ "hedonist.ky@gmail.com" ]
hedonist.ky@gmail.com
3deae6ebe37439a6af6d9dd578da0e217f3e683e
1d648473ed374a1047e6986f4c7f8ee3f108b66b
/be/src/runtime/date-value.h
2719466526a87d62bd137b0f17b91ce644ab3928
[ "bzip2-1.0.6", "BSD-3-Clause", "OpenSSL", "LicenseRef-scancode-google-patent-license-webrtc", "LicenseRef-scancode-openssl", "dtoa", "LicenseRef-scancode-unknown-license-reference", "PSF-2.0", "MIT", "Minpack", "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "LicenseRef-scanc...
permissive
amansinha100/impala
3422d0cdee83a47a5d0d774278229823b5d32a67
e05a5323785ecb09e45bdb5dfc96533e68256175
refs/heads/master
2020-08-26T22:17:54.958615
2019-10-08T20:22:57
2019-10-22T04:31:20
217,164,646
0
0
Apache-2.0
2019-10-23T22:28:28
2019-10-23T22:28:28
null
UTF-8
C++
false
false
8,217
h
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you 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 <limits> #include <string> #include "common/logging.h" #include "common/status.h" #include "udf/udf.h" namespace impala { namespace datetime_parse_util { struct DateTimeFormatContext; } /// Represents a DATE value. /// - The minimum and maximum dates are 0001-01-01 and 9999-12-31. Valid dates must fall /// in this range. /// - Internally represents DATE values as number of days since 1970-01-01. /// - This representation was chosen to be the same (bit-by-bit) as Parquet's date type. /// (https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#date) /// - Proleptic Gregorian calendar is used to calculate the number of days since epoch, /// which can lead to different representation of historical dates compared to Hive. /// (https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar). /// - Supports construction from year-month-day triplets. In this case, CCTZ is used to /// check the validity of date. /// - A DateValue instance will be invalid in the following cases: /// - If created using the default constructor. /// - If constructed from out-of-range or invalid year-month-day values. /// - If parsed from a date string that is not valid or represents an out-of-range /// date. /// - Note, that boost::gregorian::date could not be used for representation/validation /// due to its limited range. class DateValue { public: static const DateValue MIN_DATE; static const DateValue MAX_DATE; /// Default constructor creates an invalid DateValue instance. DateValue() : days_since_epoch_(INVALID_DAYS_SINCE_EPOCH) { DCHECK(!IsValid()); } explicit DateValue(int64_t days_since_epoch) : days_since_epoch_(INVALID_DAYS_SINCE_EPOCH) { DCHECK(!IsValid()); if (LIKELY(days_since_epoch >= MIN_DAYS_SINCE_EPOCH && days_since_epoch <= MAX_DAYS_SINCE_EPOCH)) { days_since_epoch_ = static_cast<int32_t>(days_since_epoch); DCHECK(IsValid()); } } DateValue(int64_t year, int64_t month, int64_t day); bool IsValid() const { return days_since_epoch_ != INVALID_DAYS_SINCE_EPOCH; } /// If this DateValue instance is valid, return the string representation formatted as /// 'yyyy-MM-dd'. /// Otherwise, return empty string. std::string ToString() const; /// If this DateValue instance is valid, convert it to year-month-day and return true. /// Result is placed in 'year', 'month', 'day'. /// Otherwise, return false. bool ToYearMonthDay(int* year, int* month, int* day) const WARN_UNUSED_RESULT; /// If this DateValue instance is valid, convert it to year and return true. Result is /// placed in 'year'. /// Otherwise, return false. bool ToYear(int* year) const WARN_UNUSED_RESULT; /// If DateValue instance is valid, returns day-of-week in [0, 6] range; 0 = Monday and /// 6 = Sunday. /// Otherwise, return -1. int WeekDay() const; /// If DateValue instance is valid, returns day-of-year in [1, 366] range. /// Otherwise, return -1. int DayOfYear() const; /// Returns the week corresponding to his date. Returned value is in the [1, 53] range. /// Weeks start with Monday. Each week's year is the Gregorian year in which the /// Thursday falls. int WeekOfYear() const; /// If this DateValue instance valid, add 'days' days to it and return the result. /// Otherwise, return an invalid DateValue instance. DateValue AddDays(int64_t days) const; /// If this DateValue instance valid, add 'months' months to it and return the result. /// Otherwise, return an invalid DateValue instance. /// If 'keep_last_day' is set and this DateValue is the last day of a month, the /// returned DateValue will fall on the last day of the target month too. DateValue AddMonths(int64_t months, bool keep_last_day) const; /// If this DateValue instance valid, add 'years' years to it and return the result. /// Otherwise, return an invalid DateValue instance. DateValue AddYears(int64_t years) const; /// If this DateValue instance is valid, convert it to the number of days since epoch /// and return true. Result is placed in 'days'. /// Otherwise, return false. bool ToDaysSinceEpoch(int32_t* days) const WARN_UNUSED_RESULT; /// If this DateValue instance is valid, return DateValue corresponding to the last day /// of the current month. /// Otherwise, return an invalid DateValue instance. DateValue LastDay() const; /// If this DateValue and 'other' are both valid, set 'months_between' to the number of /// months between dates and return true. Otherwise return false. /// If this is later than 'other', then the result is positive. If this is earlier than /// 'other', then the result is negative. If this and 'other' are either the same days /// of the month or both last days of months, then the result is always an integer. /// Otherwise calculate the fractional portion of the result based on a 31-day month. bool MonthsBetween(const DateValue& other, double* months_between) const; /// Returns a DateVal representation in the output variable. /// Returns null if the DateValue instance doesn't have a valid date. impala_udf::DateVal ToDateVal() const { if (!IsValid()) return impala_udf::DateVal::null(); return impala_udf::DateVal(days_since_epoch_); } /// Returns the underlying storage. There is only one representation for any DateValue /// (including the invalid DateValue) and the storage is directly comparable. int32_t Value() const { return days_since_epoch_; } /// Returns a DateValue converted from a DateVal. The caller must ensure the DateVal /// does not represent a NULL. static DateValue FromDateVal(const impala_udf::DateVal& udf_value) { DCHECK(!udf_value.is_null); return DateValue(udf_value.val); } /// Constructors that parse from a date string. See DateParser for details about the /// date format. static DateValue ParseSimpleDateFormat(const char* str, int len, bool accept_time_toks); static DateValue ParseSimpleDateFormat(const std::string& str, bool accept_time_toks); static DateValue ParseSimpleDateFormat(const char* str, int len, const datetime_parse_util::DateTimeFormatContext& dt_ctx); static DateValue ParseIsoSqlFormat(const char* str, int len, const datetime_parse_util::DateTimeFormatContext& dt_ctx); /// Format the date using the given 'dt_ctx' format context. If *this is invalid /// returns an empty string. std::string Format(const datetime_parse_util::DateTimeFormatContext& dt_ctx) const; bool operator==(const DateValue& other) const { return days_since_epoch_ == other.days_since_epoch_; } bool operator!=(const DateValue& other) const { return !(*this == other); } bool operator<(const DateValue& other) const { return days_since_epoch_ < other.days_since_epoch_; } bool operator>(const DateValue& other) const { return other < *this; } bool operator<=(const DateValue& other) const { return !(*this > other); } bool operator>=(const DateValue& other) const { return !(*this < other); } private: /// Number of days since 1970.01.01. int32_t days_since_epoch_; static const int32_t MIN_DAYS_SINCE_EPOCH; static const int32_t MAX_DAYS_SINCE_EPOCH; static const int32_t INVALID_DAYS_SINCE_EPOCH = std::numeric_limits<int32_t>::min(); }; std::ostream& operator<<(std::ostream& os, const DateValue& date_value); }
[ "impala-public-jenkins@cloudera.com" ]
impala-public-jenkins@cloudera.com
05ee978e2dc44a4c4847b0cbb6522aa10cef1bed
000a7af455ed3f5f534b28b18be0b5997ddbdefa
/Includes/Internals/TComp/TTabCtrl.cpp
595af19d774f2f127e3d1d99435d17f4188b768c
[]
no_license
boyfromhell/4Ever
6f58182c07182f9569201dbc0f9116cc6644d296
8bd1d638f9ae23c3b97a56bd04f00061f39fbe61
refs/heads/master
2020-04-15T14:21:14.071423
2018-07-22T17:07:17
2018-07-22T17:07:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,316
cpp
// TTabCtrl.cpp: implementation of the TTabCtrl class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// TTabCtrl::TTabCtrl(TComponent *pParent, LP_FRAMEDESC pDesc) :TComponent(pParent, pDesc) { int nCount = 0; m_bType = TCML_TYPE_TABCTRL; TCOMP_LIST::iterator it = GetFirstKidsFinder(); while(!EndOfKids(it)) {//Should be state buttons for TabCtrl TComponent* pKid = GetNextKid(it); if( pKid && pKid->IsTypeOf( TCML_TYPE_BUTTON ) ) { nCount ++; ((TButton *) pKid)->SetStateButton(); m_Buttons.push_back((TButton *) pKid); pKid->SetTextAlign(m_flagAlign); pKid->EnableComponent(FALSE); pKid->ShowComponent(FALSE); } } for( int i=0; i<nCount; i++) m_Frames.push_back(NULL); } TTabCtrl::~TTabCtrl() { } void TTabCtrl::OnLButtonDown( UINT nFlags, CPoint pt ) { if( !CanProcess() || !HitTest(pt) ) return; TCOMP_LIST::iterator it = GetFirstKidsFinder(); while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if(pKid) pKid->OnLButtonDown(nFlags, pt); } } void TTabCtrl::OnLButtonUp( UINT nFlags, CPoint pt ) { if( !CanProcess() || !HitTest(pt) ) return; TCOMP_LIST::iterator it = GetFirstKidsFinder(); while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if(pKid) pKid->OnLButtonUp(nFlags, pt); } } void TTabCtrl::OnMouseMove( UINT nFlags, CPoint pt ) { if( !CanProcess() || !HitTest(pt) ) return; TCOMP_LIST::iterator it = GetFirstKidsFinder(); while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if(pKid) pKid->OnMouseMove(nFlags, pt); } } void TTabCtrl::OnRButtonDown( UINT nFlags, CPoint pt ) { if( !CanProcess() || !HitTest(pt) ) return; TCOMP_LIST::iterator it = GetFirstKidsFinder(); while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if(pKid) pKid->OnRButtonDown(nFlags, pt); } } void TTabCtrl::OnRButtonUp( UINT nFlags, CPoint pt ) { if( !CanProcess() || !HitTest(pt) ) return; TCOMP_LIST::iterator it = GetFirstKidsFinder(); while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if(pKid) pKid->OnRButtonUp(nFlags, pt); } } void TTabCtrl::OnNotify( DWORD from, WORD msg, LPVOID param ) { switch(msg) { case TNM_LCLICK : if(FindKid(from)) SelectItem(*(int *) param); break; } } BOOL TTabCtrl::InsertItem( int nItem, LPCTSTR lpszItem, LP_FRAMEDESC pDescFrame ) { if( !pDescFrame || pDescFrame->m_vCOMP.m_bType != TCML_TYPE_FRAME || nItem < 0 || nItem >= m_Buttons.size() ) return FALSE; DeleteItem(nItem); TFrame *pFrame = (TFrame *) AddKid(pDescFrame); CRect rect; GetComponentRect(&rect); pFrame->MoveComponent(CPoint( 0, rect.Height())); m_Buttons[nItem]->SetComponentText(lpszItem); m_Buttons[nItem]->EnableComponent(TRUE); m_Buttons[nItem]->ShowComponent(TRUE); m_Frames[nItem] = pFrame; SelectItem(nItem); return TRUE; } void TTabCtrl::DeleteItem( int nItem) { if( nItem >= 0 && nItem < m_Frames.size() && nItem < m_Buttons.size() && m_Buttons[nItem] && m_Frames[nItem] ) { m_Buttons[nItem]->SetComponentText(_T("")); m_Buttons[nItem]->EnableComponent(FALSE); m_Buttons[nItem]->ShowComponent(FALSE); RemoveKid(m_Frames[nItem]); delete m_Frames[nItem]; m_Frames[nItem] = NULL; } } void TTabCtrl::SelectItem( int nItem) { int nSize = m_Buttons.size(); for( int i=0; i<nSize; i++) { m_Buttons[i]->Select(i == nItem); if(m_Frames[i]) m_Frames[i]->ShowComponent(m_Buttons[i]->IsVisible() && i == nItem); } } void TTabCtrl::ShowComponent( BOOL bVisible) { TCOMP_LIST::iterator it = GetFirstKidsFinder(); m_bVisible = bVisible; while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if( pKid && !pKid->m_blIsCaret && pKid->IsTypeOf(TCML_TYPE_BUTTON) && pKid->IsTypeOf(TCML_TYPE_FRAME) ) pKid->ShowComponent(bVisible); } } void TTabCtrl::EnableComponent( BOOL bEnable) { TCOMP_LIST::iterator it = GetFirstKidsFinder(); m_bEnable = bEnable; while(!EndOfKids(it)) { TComponent *pKid = GetNextKid(it); if( pKid && !pKid->m_blIsCaret && pKid->IsTypeOf(TCML_TYPE_BUTTON) && pKid->IsTypeOf(TCML_TYPE_FRAME) ) pKid->EnableComponent(bEnable); } }
[ "pierre.bouffier05@gmail.com" ]
pierre.bouffier05@gmail.com
95416de8bdf45bf8f3be693adbb87fa593f3f24b
316e92de84c43eb4cef8572de973c3c3c4ad864c
/tools/checker.h
85fc47caa057fd3357c476625b7ec25953742483
[]
no_license
ShenJinglong/LZ-compressor
73a3cefecc96fd1236920f1dce7d9c72c74e8857
e75159f2172a13de3c27757cb983fee0c558be40
refs/heads/master
2021-05-22T17:10:15.541936
2020-04-04T21:48:10
2020-04-04T21:48:10
253,015,936
0
0
null
null
null
null
UTF-8
C++
false
false
2,447
h
#ifndef CHECKER_H_ #define CHECKER_H_ #include <string.h> #include "debug.h" #include "utilities.h" #include "../BitOperator/BitReader.h" #include "../BitOperator/BitWriter.h" #include "../HuffmanCodec/HuffmanEncoder.h" #include "../HuffmanCodec/HuffmanDecoder.h" /** * @brief: check the utilities block */ void check_utilities() { CHECK(log2(16) == 4); CHECK(toBinary(15, 8) == "00001111"); LOGV(0, "UTILITIES CHECKED ...\n"); } /** * @brief: check the bit operator block */ void check_bit_operator() { uint8_t test_buffer[4]; BitWriter writer(test_buffer); writer.writeBits(1, 8); writer.writeBits(2, 16); writer.writeBits(3, 7); writer.writeBit(1); writer.finish(); BitReader reader(test_buffer, test_buffer + 4); CHECK(reader.readBits(8) == 1); CHECK(reader.readBits(16) == 2); CHECK(reader.readBits(7) == 3); CHECK(reader.readBit() == 1); LOGV(0, "BIT OPERATOR CHECKED ...\n"); } /** * @brief: check huffman codec block */ void check_huffman_codec() { int64_t len = 20; uint8_t buffer_in[len] = {5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9, 4, 5, 2, 1, 7, 4, 5, 3, 8}; uint8_t buffer_out[len + 385]; // the maximum size of huffman tree table is 385 bytes (256 + 256 / 2 + 1) uint8_t buffer_recover[len]; HuffmanEncoder encoder(buffer_out); for (int64_t i = 0; i < len; ++i) { encoder.scan(buffer_in[i]); } encoder.buildTable(); for (int64_t i = 0; i < len; ++i) { encoder.encode(buffer_in[i]); } encoder.finish(); // Don't forget to call finish(), this function is used to make sure that all bits in the buffer are written to bit stream. // BitReader reader(buffer_out, buffer_out + len + 385); // for (int i = 0; i < len + 385; ++i) { // reader.refill(); // LOGV(2, std::string(toBinary(reader.readBits(8), 8) + "\n").c_str()); // } HuffmanDecoder decoder(buffer_out, buffer_out + len + 385); decoder.readTable(); decoder.decode(buffer_recover, buffer_recover + len); // for (int i = 0; i < len; ++i) { // LOGV(1, "%d\n", buffer_recover[i]); // } CHECK(memcmp(buffer_in, buffer_recover, len) == 0); LOGV(0, "HUFFMAN CODEC CHECKED ...\n"); } /** * @brief: check the whole system */ void check_all() { check_utilities(); check_bit_operator(); check_huffman_codec(); LOGV(0, "ALL BLOCKS HAVE CHECKED ...\n"); } #endif
[ "1368351931@qq.com" ]
1368351931@qq.com
6a03fdb876c89b8a4e510464e8fdab451a9fc3ad
ef9a782df42136ec09485cbdbfa8a56512c32530
/tags/Fassetv2.2.2/source/livestock/pig.cpp
4d95b712d1b31ab07fea46922f91bed9e7a15d61
[]
no_license
penghuz/main
c24ca5f2bf13b8cc1f483778e72ff6432577c83b
26d9398309eeacbf24e3c5affbfb597be1cc8cd4
refs/heads/master
2020-04-22T15:59:50.432329
2017-11-23T10:30:22
2017-11-23T10:30:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
20,682
cpp
/****************************************************************************\ $URL$ $LastChangedDate$ $LastChangedRevision$ $LastChangedBy$ \****************************************************************************/ #include "../base/common.h" #include "../products/feedItem.h" #include "../products/products.h" #include "pig.h" #include "../base/base.h" #include "../base/nixcbits.h" #include "../base/message.h" #include "../base/IndicatorOutput.h" /****************************************************************************\ Constructor with arguments \****************************************************************************/ pig::pig(const char *aName,const int aIndex,const base * aOwner): animal(aName,aIndex,aOwner) { NumberPrDay = 0.0; NumberPrYear = 0.0; variableCosts = 0.0; lysin_need = 0.0; meth_need = 0.0; treo_need = 0.0; P_need = 0.0; K_need = 0.0; SetAlias(aName); feedItemList = new linkList <product>; } /****************************************************************************\ Destructor \****************************************************************************/ pig::~pig() { delete feedItemList; } /****************************************************************************\ Called daily Will need updating if pigs are outside animal housing (as for cattle) CHECK TO SEE IF FEED REMOVED TWICE !!! \****************************************************************************/ void pig::DailyUpdate() { animal::DailyUpdate(); feedItem *afeedItem; if (currentfeed) delete currentfeed; currentfeed = new feedItem("feedmix",0,this); for (int i=0; i<feedItemList->NumOfNodes(); i++) { afeedItem = (feedItem*) feedItemList->ElementAtNumber(i); feedItem * storedfeedItem =(feedItem *) theProducts->GetCopyStoredFeedProduct(afeedItem); //returns a copy of the product if it is found in storage if ((storedfeedItem)&&(storedfeedItem->GetAmount()>0.0)) { storedfeedItem->Setamount(afeedItem->GetAmount()); theProducts->SubtractProduct(storedfeedItem); // subtract feed from storage *currentfeed = *currentfeed + *storedfeedItem; delete storedfeedItem; } else { if (afeedItem->GetproteinN_digestibility()<0.0) { cout << "attempt to access feed with protein digestibility less than zero, code = " << afeedItem->GetCode() << endl; theMessage->FatalError("Pig:: "); } theProducts->SubtractProduct(afeedItem); // subtract feed from storage *currentfeed = *currentfeed + *afeedItem; } } if (currentfeed->GetAmount()==0) theMessage->FatalError("Pig:: No feed provided!"); double surplusN = ProduceManure(fluidManurePrDay,solidManurePrDay); // calculates the amount of manure pr day; // while (surplusN<0) //iteration necessary as feed quality could vary with amount requested from store, if several stores contain the desired feed if (surplusN<0) { theMessage->FatalError("Pig:: Insufficient protein in feed for ", GetName()); //note - this can be caused if the feed characteristics are not defined in feedtable. /* surplusN=fabs(surplusN)*1.01; //add 1% to avoid problems with rounding errors GetExtraFeed(surplusN); //then get more feed surplusN = ProduceManure(fluidManurePrDay,solidManurePrDay); // calculates the amount of manure pr day;*/ } *manurePrDay = *fluidManurePrDay; *manurePrDay = *manurePrDay + *solidManurePrDay; // Nbudget.AddInput(manurePrDay->GetAmount()*manurePrDay->GetAllN().n); GetStableSection()->RcvManure(fluidManurePrDay,solidManurePrDay); // manure to stable // fudge - should calculate heat from diet + latent heat loss // GetStableSection()->AddanimalHeatOp(NumberPrDay*heatProduction); double CinFeed = currentfeed->GetAmount() * currentfeed->GetC_content(); double CinSoldPig = NumberPrDay*C_growth; double CinManure = manurePrDay->GetAmount()*manurePrDay->GetC_content(); double CinCH4 = 0.01*GetGrossEnergyinDryMatter() *currentfeed->GetAmount() *currentfeed->GetdryMatter()/55.55; theOutput->AddIndicator(environmentalIndicator,"44.64 C in pig CH4 production","kg C",CinCH4*1000.0); double CinCO2 = CinFeed - (CinSoldPig + CinManure + CinCH4); if (CinCO2<0.0) {theMessage->FatalError("pig::DailyUpdate - CO2 production cannot be negative");} theOutput->AddIndicator(environmentalIndicator,"44.63 C in pig CO2 production","kg C",CinCO2*1000.0); /* Nbudget.AddOutput(manurePrDay->GetAmount()*manurePrDay->GetAllN().n); Nbudget.AddOutput(NumberPrDay * N_growth); Cbudget.AddOutput(CinManure+CinSoldPig+CinCH4+CinCO2); Nbudget.Balance(0.0); Cbudget.Balance(0.0); */ // cout << GetName() << &Nbudget << endl; } /****************************************************************************\ \****************************************************************************/ void pig::GetExtraFeed(double NRequired) { feedItem* afeedItem = (feedItem*) theProducts->GetProductElement(499); feedItem * storedfeedItem =(feedItem *) theProducts->GetCopyStoredFeedProduct(afeedItem); //returns a copy of the product if it is found in storage feedItem* feedItemClone = NULL; if (!storedfeedItem) feedItemClone=(feedItem*)afeedItem->clone(); else feedItemClone = storedfeedItem; double totalNconc = feedItemClone->GetAllN().n; double proteinNconc = feedItemClone->Getprotein_N(); double digestibleProteinNconc = proteinNconc * feedItemClone->GetproteinN_digestibility(); double otherNconc = totalNconc-proteinNconc; double amountNeeded = NRequired/(otherNconc+digestibleProteinNconc); feedItemClone->Setamount(amountNeeded); theProducts->SubtractProduct(feedItemClone); // subtract feed from storage *currentfeed = *currentfeed + *feedItemClone; delete feedItemClone; theMessage->Warning("Pig:: ", GetName()," N deficiency - extra feed fed"); } /****************************************************************************\ \****************************************************************************/ void pig::ReceivePlan(char* fileName) { currentfeed->Setamount(0.0); UnsetCritical(); if(!OpenInputFile(fileName)) { strcpy(fileName,"pigsfeed.fnn"); if (!OpenInputFile(fileName)) theMessage->FatalError("pig::ReceivePlan - error in opening pigfeed.f??"); } string logString = ("------------ Reading "+(string) this->GetName()+" feeding plan from file "+fileName) ; theMessage->LogEvent((char*) logString.c_str()); cout << "------------ Reading " << (string) this->GetName() << " feeding plan ------------" << " from " << fileName << endl; Setcur_pos(0); string animalName; string namestr; namestr=(string) "Group"; int first,num; GetSectionNumbers((char*) namestr.c_str(),&first,&num); //count the number of periods for which a diet is defined int index=first; bool gotit=false; while ((index<(first+num))&&(!gotit)) { FindSection((char*) namestr.c_str(),index); // find the correct place in the input file string animalName = GetAlias().c_str(); string thisAlias; GetParameter("Alias",&thisAlias); if (thisAlias==animalName) //then this is the animal group we want here { gotit=true; char Indexstr[10]; sprintf(Indexstr,"(%d)",index); namestr=(string) "Group"+Indexstr+"."+"Feed"; } else index++; } if (!gotit) theMessage->FatalError("pig::ReceivePlan - cannot find pig group in pigfeed.f??"); else { feedItemList->Reset(); GetSectionNumbers((char*) namestr.c_str(),&first,&num); //count the number of feeds for(int index=first;index<(first+num);index++) { FindSection((char*) namestr.c_str(),index); // find feed int feedCode; product* afeedItem; product* feedItemClone; GetParameter("FeedCode",&feedCode); afeedItem=((product *) theProducts->GetProductElement(feedCode)); double feedAmount; GetParameter("Amount",&feedAmount); if (feedAmount>0.0) { feedAmount/=1000.0; // convert from kg per animal per day to tonnes per animal per day feedAmount*=NumberPrDay; // convert from tonnes per animal per day to tonnes per day feedItemClone = afeedItem->clone(); feedItemClone->Setamount(feedAmount); //set amount to total daily requirement // feedItemClone->Setamount(feedAmount); //set amount to daily requirement per animal // feedItemClone->Setamount(feedAmount/(theTime.daysInYear()*NumberPrDay)); //set amount to daily requirement per animal feedItemList->InsertLast(feedItemClone); //load feed items into the feed item list *currentfeed = (*currentfeed) + (*feedItemClone); } } } CloseInputFile(); } /****************************************************************************\ Calculate production of dung and urine, returns N surplus in diet \****************************************************************************/ double pig::ProduceManure(manure* fluidManure, manure* solidManure) { string animalName =this->GetName(); double surplus_digestibleN=0.0,Nconc=0.0; double totalAmountPrDay; if (NumberPrDay>1e-10) { // Fluid manure double amountfeed = currentfeed->GetAmount(); double energyInput = currentfeed->GetAmount() * currentfeed->GetpigFeedUnitsPerItemUnit(); if (energyInput<0.75*(NumberPrDay*FE_need)) // BMP changed this january 2007 { if (energyInput<0.50*(NumberPrDay*FE_need)) { cout << endl; cout << "Energy as percentage of requirement = " << (100.0*energyInput/(NumberPrDay*FE_need)) << endl; theMessage->FatalError("pig::ProduceManure - ",Alias.c_str()," Very low amount of energy in feed"); } else theMessage->Warning("pig::ProduceManure - ",Alias.c_str()," Insufficient energy in feed"); } if (energyInput>1.6*(NumberPrDay*FE_need)) { double energyPercent = 100.0*energyInput/(NumberPrDay*FE_need); theMessage->WarningWithDisplay(Alias.c_str(),energyPercent,"% excess energy in feed "); } double totalNInput = amountfeed * currentfeed->GetAllN().n; double protein_N_conc = currentfeed->Getprotein_N(); double proteinNDigested = amountfeed*protein_N_conc*(currentfeed->GetproteinN_digestibility()); double ammoniumRatio; // CHECK!!!! value taken from "Kv�lstof i husdyrg�dning", 1990, J.F. Hansen et al. double other_N = amountfeed*(currentfeed->GetAllN().n-protein_N_conc); Nbudget.AddInput(totalNInput); double totalCInput = amountfeed * currentfeed->GetC_content(); Cbudget.AddInput(totalCInput); //urine N is the difference between the digested N (protein + other) and the N used for growth surplus_digestibleN = other_N + proteinNDigested - NumberPrDay * N_growth; /* cout << Alias << " N in feed per day per individual (kg N) " << (1000*totalNInput/NumberPrDay) << endl; // Test - remove !!! cout << "N growth per day per individual (kg N) " << N_growth*1000.0 << endl; cout << "Protein digestibility " << currentfeed->GetproteinN_digestibility() << endl; cout << endl; // Test - remove !!! */ if (surplus_digestibleN>=0) { //solid manure totalAmountPrDay = amountSolid*NumberPrDay/1000.0; //convert to tonnes ammoniumRatio=0.0; //CHECK //faecal N is the undigested protein N Nconc = (amountfeed*protein_N_conc-proteinNDigested)/totalAmountPrDay; if (Nconc<0.0) theMessage->FatalError("pig::protein N digested greater than protein N present"); solidManure->Setname("SOLID-MANURE"); theProducts->GiveProductInformation(solidManure); // sets the default values for solid-manure // solidManure->SetfromAnimal(animalName); solidManure->SetfromAnimal("pig"); solidManure->Setamount(totalAmountPrDay); solidManure->SetorgN_content((1.0-ammoniumRatio)*Nconc); solidManure->SetNH4_content(ammoniumRatio*Nconc); solidManure->SetNO3_content(0.0); double faecalCarbon = amountfeed*currentfeed->GetC_content()* (1-currentfeed->GetOMD()); solidManure->SetC_content(faecalCarbon/totalAmountPrDay); solidManure->SetP_content(amountfeed*(currentfeed->GetP_content())*(1.0-currentfeed->GetP_digest())/totalAmountPrDay); solidManure->SetK_content((amountfeed*(currentfeed->GetK_content())-NumberPrYear*K_growth)/totalAmountPrDay); solidManure->SetpH(7.6); ammoniumRatio=1.0; //CHECK !!! fluidManure->Setname("FLUID-MANURE"); theProducts->GiveProductInformation(fluidManure); totalAmountPrDay = amountFluid*NumberPrDay/1000.0; //convert to tonnes fluidManure->Setamount(totalAmountPrDay); // fluidManure->SetfromAnimal(animalName); fluidManure->SetfromAnimal("pig"); Nconc=surplus_digestibleN/totalAmountPrDay; double urineCconc = Nconc*60.0/28.0; //assumes all N in urine is urea (ratio of C to N in urea (2*(NH2) + CO)) fluidManure->SetorgN_content((1.0-ammoniumRatio)*Nconc); fluidManure->SetNH4_content(ammoniumRatio*Nconc); fluidManure->SetNO3_content(0.0); fluidManure->SetC_content(urineCconc); fluidManure->SetP_content((amountfeed*(currentfeed->GetP_content())*(currentfeed->GetP_digest())-NumberPrDay*P_growth)/totalAmountPrDay); fluidManure->SetK_content(0.0); // rettes senere fluidManure->SetpH(8.0); double balance = totalNInput - (fluidManure->GetAmount() * fluidManure->GetAllN().n + solidManure->GetAmount() * solidManure->GetAllN().n + NumberPrDay * N_growth); if(fabs(balance)>0.0001) theMessage->FatalError("pig::ProduceManure - error in N balance in pig manure partitioning"); } else theMessage->FatalError("pig::ProduceManure - ",animalName.c_str()," required additional protein in feed"); // BMP modified this !!! double Nefficiency = NumberPrDay * N_growth/totalNInput; if (Nefficiency>0.7) theMessage->FatalError("pig::ProduceManure - N efficiency over 70%"); } else { // sets the default values for manure fluidManure->Setname("FLUID-MANURE"); theProducts->GiveProductInformation(fluidManure); fluidManure->Setamount(0.0); fluidManure->SetfromAnimal(animalName); solidManure->Setname("SOLID-MANURE"); theProducts->GiveProductInformation(solidManure); solidManure->SetfromAnimal(animalName); solidManure->Setamount(0.0); } return surplus_digestibleN; } /****************************************************************************\ Function: ManureProduction Purpose: Parameters: fstream* fileStream Comments: \****************************************************************************/ void pig::ManureProduction(fstream* fileStream) { theMessage->FatalError("Function in pig not implemented"); *fileStream << ".LIQM 0.0\n"; //dummy line which is never reached - stops a warning /* if (Stable->GetSlurrySystem()) { *fileStream << Name << ".SLUR " << (amountFluid+amountSolid)*feedingDays()/theTime.daysInYear() << "\n"; *fileStream << Name << ".DUNG 0.0\n"; *fileStream << Name << ".LIQM 0.0\n"; } else { *fileStream << Name << ".SLUR 0.0\n"; *fileStream << Name << ".DUNG " << amountSolid << "\n"; *fileStream << Name << ".LIQM " << amountFluid << "\n"; } */ } /****************************************************************************\ Function: FeedMax Purpose: Parameters: fstream* fileStream Comments: \****************************************************************************/ void pig::FeedMax( fstream* fileStream) { *fileStream << Name << ".FE " << 2*FE_need << "\n"; // amount just approximately *fileStream << Name << ".LYSIN " << 10*lysin_need*1000 << "\n"; *fileStream << Name << ".METHI " << 10*meth_need*1000 << "\n"; *fileStream << Name << ".TREON " << 10*treo_need*1000 << "\n"; *fileStream << Name << ".PHOS " << 10*P_need*1000 << "\n"; } /****************************************************************************\ Function: FeedMin Purpose: Parameters: fstream* fileStream Comments: \****************************************************************************/ void pig::FeedMin( fstream* fileStream) { *fileStream << Name << ".FE " << FE_need << "\n"; *fileStream << Name << ".LYSIN " << lysin_need*1000 << "\n"; *fileStream << Name << ".METHI " << meth_need*1000 << "\n"; *fileStream << Name << ".TREON " << treo_need*1000 << "\n"; *fileStream << Name << ".PHOS " << P_need*1000 << "\n"; } /****************************************************************************\ \****************************************************************************/ void pig::ReadParameters(fstream * file) { animal::ReadParameters(file); Setfile(file); Setcur_pos(0); SetCritical(); FindSection(GetName(),GetIndex()); // find the correct place in the input file GetParameter("LivestockUnits",&LivestockUnits); GetParameter("FE_need",&FE_need); GetParameter("lysin_need",&lysin_need); GetParameter("meth_need",&meth_need); GetParameter("treo_need",&treo_need); UnsetCritical(); Setfile(NULL); } /****************************************************************************\ \****************************************************************************/ void pig::EndBudget(bool show) { if (show) { cout << "Balance for " << GetName() << endl; cout << Nbudget; } double NRemaining=0; NRemaining=Nbudget.GetInput()-Nbudget.GetOutput(); if (NRemaining!=0) theMessage->FatalError(GetName(),"pig::EndBudget - N budget error"); } /****************************************************************************\ Truncate a name to the first occurance of underscore - used to look for feed for a general class e.g. SOWS rather than SOWS_PREGNANT \****************************************************************************/ bool pig::TruncateName(string * ret_string) { string buffer = this->GetName(); *ret_string=""; int count=0; while ((count<int(buffer.length()))&& (buffer[count]!='_')) { *ret_string=*ret_string + buffer[count]; count++; } if (ret_string->length()==buffer.length()) return false; return true; } /****************************************************************************\ \****************************************************************************/ feedItem * pig::GetFeedItem(product * menuPtr) { feedItem * afeedItem; product * aStoredProduct =theProducts->GetCopyStoredFeedProduct(menuPtr); //returns a copy of the product if it is found in storage afeedItem = new feedItem(*(feedItem*) menuPtr); if (aStoredProduct) { if (aStoredProduct->GetAmount()>0.0) { //this section updates the default variables with the actual characteristics of the feed stored //if there is not enough in store, the remainder will later be imported WITH THE SAME QUALITY AS THAT WHICH WAS IN THE STORE aStoredProduct->Setamount(menuPtr->GetAmount()); afeedItem->Setamount(0.0); *afeedItem+ *aStoredProduct; delete aStoredProduct; afeedItem->Setamount(menuPtr->GetAmount()); } } // afeedItem->SetIsSupplement(true); return afeedItem; } /****************************************************************************\ \****************************************************************************/ void pig::GetDiet(feedItem * theDiet) { feedItem *afeedItem; for (int i=0; i<feedItemList->NumOfNodes(); i++) { afeedItem = (feedItem*) feedItemList->ElementAtNumber(i); *theDiet = *theDiet + *afeedItem; } } /****************************************************************************\ Return maintenance energy in W, from CIGR 2002 \****************************************************************************/ double pig::CalcMaintenanceEnergy(double weight) { return 5.09*pow(weight,0.75); }
[ "sai@agro.au.dk" ]
sai@agro.au.dk
d0f400110b043bc14801c95bc61a074221ee2ca0
2f557f60fc609c03fbb42badf2c4f41ef2e60227
/CondFormats/GEMObjects/src/GEMeMap.cc
83a0b79f4973526143c4017aea24ecdd880b3cd2
[ "Apache-2.0" ]
permissive
CMS-TMTT/cmssw
91d70fc40a7110832a2ceb2dc08c15b5a299bd3b
80cb3a25c0d63594fe6455b837f7c3cbe3cf42d7
refs/heads/TMTT_1060
2020-03-24T07:49:39.440996
2020-03-04T17:21:36
2020-03-04T17:21:36
142,576,342
3
5
Apache-2.0
2019-12-05T21:16:34
2018-07-27T12:48:13
C++
UTF-8
C++
false
false
4,203
cc
#include "CondFormats/GEMObjects/interface/GEMeMap.h" #include "CondFormats/GEMObjects/interface/GEMROMapping.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" GEMeMap::GEMeMap(): theVersion("") {} GEMeMap::GEMeMap(const std::string & version): theVersion(version) {} GEMeMap::~GEMeMap() {} const std::string & GEMeMap::version() const { return theVersion; } void GEMeMap::convert(GEMROMapping & romap) { // fed->amc->geb mapping to GEMDetId for (auto imap : theChamberMap_) { for (unsigned int ix=0;ix<imap.fedId.size();ix++) { GEMROMapping::chamEC ec; ec.fedId = imap.fedId[ix]; ec.amcNum = imap.amcNum[ix]; ec.gebId = imap.gebId[ix]; GEMROMapping::chamDC dc; dc.detId = GEMDetId((imap.gemNum[ix] > 0) ? 1:-1, 1, abs(imap.gemNum[ix]/1000), abs(imap.gemNum[ix]/100%10), abs(imap.gemNum[ix]%100), 0); dc.vfatVer = imap.vfatVer[ix]; romap.add(ec, dc); } } // chamberType to vfatType for (auto imap : theVFatMap_) { for (unsigned int ix=0;ix<imap.vfatAdd.size();ix++) { GEMDetId gemId((imap.gemNum[ix] > 0) ? 1:-1, 1, abs(imap.gemNum[ix]/1000), abs(imap.gemNum[ix]/100%10), abs(imap.gemNum[ix]%100), imap.iEta[ix]); GEMROMapping::vfatEC ec; ec.detId = gemId.chamberId(); ec.vfatAdd = imap.vfatAdd[ix] & chipIdMask_; GEMROMapping::vfatDC dc; dc.vfatType = imap.vfatType[ix]; dc.detId = gemId; dc.localPhi = imap.localPhi[ix]; romap.add(ec, dc); romap.add(gemId.chamberId(),ec); } } // channel mapping for (auto imap : theStripMap_) { for (unsigned int ix=0;ix<imap.vfatType.size();ix++) { GEMROMapping::channelNum cMap; cMap.vfatType = imap.vfatType[ix]; cMap.chNum = imap.vfatCh[ix]; GEMROMapping::stripNum sMap; sMap.vfatType = imap.vfatType[ix]; sMap.stNum = imap.vfatStrip[ix]; romap.add(cMap, sMap); romap.add(sMap, cMap); } } } void GEMeMap::convertDummy(GEMROMapping & romap) { // 12 bits for vfat, 5 bits for geb, 8 bit long GLIB serial number unsigned int fedId = FEDNumbering::MINGEMFEDID; uint8_t amcNum = 0; //amc uint8_t gebId = 0; for (int re = -1; re <= 1; re = re+2) { for (int st = GEMDetId::minStationId; st<=GEMDetId::maxStationId; ++st) { int maxVFat = maxVFatGE11_; if (st == 2) maxVFat = maxVFatGE21_; if (st == 0) maxVFat = maxVFatGE0_; for (int ch = 1; ch<=GEMDetId::maxChamberId; ++ch) { for (int ly = 1; ly<=GEMDetId::maxLayerId; ++ly) { GEMDetId gemId(re, 1, st, ly, ch, 0); GEMROMapping::chamEC ec; ec.fedId = fedId; ec.gebId = gebId; ec.amcNum = amcNum; GEMROMapping::chamDC dc; dc.detId = gemId; dc.vfatVer = vfatVerV3_; romap.add(ec, dc); uint16_t chipPos = 0; for (int lphi = 0; lphi < maxVFat; ++lphi) { for (int roll = 1; roll<=maxEtaPartition_; ++roll) { GEMROMapping::vfatEC vec; vec.vfatAdd = chipPos; vec.detId = gemId; GEMROMapping::vfatDC vdc; vdc.vfatType = vfatTypeV3_;// > 10 is vfat v3 vdc.detId = GEMDetId(re, 1, st, ly, ch, roll); vdc.localPhi = lphi; romap.add(vec,vdc); romap.add(gemId.chamberId(),vec); chipPos++; } } // 1 geb per chamber gebId++; // 5 bits for gebId if (gebId == maxGEBs_) { // 24 gebs per amc gebId = 0; amcNum++; } if (amcNum == maxAMCs_) { gebId = 0; amcNum = 0; fedId++; } } } } } for (int i = 0; i < maxChan_; ++i) { // only 1 vfat type for dummy map GEMROMapping::channelNum cMap; cMap.vfatType = vfatTypeV3_; cMap.chNum = i; GEMROMapping::stripNum sMap; sMap.vfatType = vfatTypeV3_; sMap.stNum = i; romap.add(cMap, sMap); romap.add(sMap, cMap); } }
[ "jason.lee@cern.ch" ]
jason.lee@cern.ch